I had to write a program for a simple math game, i wrote the program it had a few errors i fixed the errors, or so i thought, the program compiled but then when i went to run the exe file i got 3 error LNK2019: unresolved external symbols _If
_mult
_sub
i have no idea how to resolve these 3 errors nor what the error is referring to, an insight would be greatly appreciated.
Here is my Code for the Program.

Well, you prototyped the mult, div, add and sub functions...did you expect them to just magically appear? Well the compiler (actually, the linker to be specific) doesn't...it expects you to provide them, and when you don't -- or provide them differently that prototyped -- what's the error? You guessed it...Frank Stallone.

Or "unresolved external symbol" for each function it can't find or match up to its prototype.

10-02-2009

msween21

im sorry Rags, thank you for your help, and i dont want to frustrate or annoy you.

But i dont understand really. How did i prototype them?

10-03-2009

Muster Mark

Allow me to try to help

Quote:

Originally Posted by msween21

im sorry Rags, thank you for your help, and i dont want to frustrate or annoy you.

But i dont understand really. How did i prototype them?

I am very new myself, but I think I can give you some help. I am merely learning from a book, but perhaps my knowledge is useful.

There are very many errors in your code. The first thing I noticed was that you declared variables outside of a function.

Notice how all those variables are declared before invoking main()? As far I know, variables declarations are function specific (this has nothing to do with using variables from one function as input for another one).

The next thing I noticed was that you never defined what your other functions, like "int sub(int x, int y)" etc. do with their input. You prototyped them (gave them a name, and defined what kind of input they take) but never wrote them (or did you just not post them?). Actually, it looks like you tried to define them, but did it inside main(). This won't work at all.

You are asking for alphabetic input and reading it as an integer. I believe this can cause serious problems. Also, "yes" and "no" have never been given values (at least I couldn't find where you did it) so comparing q to them is meaningless.

As the last thing, I really couldn't understand your methodology when using braces {}. For example, the statement "if (q==yes)" (well, the first issue is that it is followed by a semicolon, meaning nothing will happen if q is equal to yes) only applies to the printf function directly following it (or it would if you took out the semicolon). You would need to open braces right before the printf and close right after ...&func); to join the printf and scanf as part of the if statement.

My advice to you is to put this program aside for a little while, read a bit more about C, and then write some programs that are much shorter and simpler. These will be so much easier to debug, and you will be able to apply what you learn directly to the one you are trying to write right now. For example, it might be educational to write a program that uses a function other than main() for a completely trivial task, so as to learn the syntax of multiple functions, while not bothering with the logic of a larger program.