• C

Unresolved Symbol

I thought i know that this error is supposed to occur when you didn't declare a variable or didn't compile a certain file which is used by main() although am using data abstraction with about 20 diffrent files in the same folder, i checked out through both my files.Am using microsoft visual C++ 6.0 compiler on windows XP pentium 4 can you advice me on how to best search for where the error is or why it might be occuring anything is welcome please. Thank you!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kent OlsenDBACommented:

Several thoughts come to mind here.

You can search all of the source files for the Unresolved Symbol.  grep(1) works well on unix environments and there are several ports to Windows platforms.  You can also use the "Search All" or "Search Files" function in your IDE.

You can also generate a loadmap when the objects are linked.  The loadmap will list the Unresolved Symbols and tell you what module referenced them.

This error appears during linking.
During compilation it was assuming that, the definition of that symbol would be found during linking and it was not found!
So, first of all see if you have defined that symbol anywhere......may be you have used it and never defined it!
If you found the definition, then see if you have included that file (containing the definition) in the project.
If that is also ok, then check the order of linking....
Hope I have made some valid points.....
Even if you are sure that all your required functions have prototypes (which is essential) -

You may be linking "C" functions with "C++" functions which may cause this error if you haven't declared your "C" functions with extern "C".

In your "C" header files use this syntax for your prototypes:

#ifdef __cplusplus
extern "C"

<all your prototypes here eg:>
long FunctionName(char *text, int Number);

#ifdef __cplusplus

The __cplusplus bit only applies the extern statement when the header file is called by a C++ function (file) and will keep the header file compatible with C and C++

Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

This is a linker error:  it means that a symbol (usually a function but occasionally an external variable) was prototyped or declared extern but that the actual declaration was missing.

The first question is, what is the unresolved symbol?

-  If the symbol is one of your functions (possibly munged) than you are probably not compiling the relevant file or have forgotten to write the function body (or misspelt it).

- If the symbol is one of your variables than you have probably declared the variable as "extern" in some header but forgotten to put the "real" variable declaration in the source file.

- If the symbol is not one of yours then you are not including a required link library.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Whatever you discovered now, was already brought out by others! So, please post if you have something new or something in addition to what others have suggested. There is no fun in repeating the same answer again and again!

What are you waiting for....Was your problem solved!? Then, why don't you tell us, what was the solution and close the question!?:-))

Sorry if you feel that I copied your answer.  I felt that I was adding some specific things he could look for.  In particular, your answer did not specifically mention externs, libraries or functions.  All were implied but, to someone who is still grokking the compile/link process, those might just be the magic words.

ssnkumar did provide the answer first.  If his answer is just what you needed, he gets all the bananas. ;)

Even Kdo and gmleeman have provided wonderful answers! They have also mentioned about functions, linker, searching for symbols etc!
So, it's not me who first provided the answer and I am not waiting to get the bananas:-)
My point is to bring to your notice that, all the points provided by you were already brought out by other experts and it will be helpful only if you could throw new light on the subject......I didn't mean anything offensive!
Sorry, if I have provoked your ego!!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.