Unresolved Symbol

Posted on 2003-11-26
Last Modified: 2010-04-15
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!
Question by:Drake009
LVL 45

Expert Comment

by:Kent Olsen
ID: 9827691

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.


Expert Comment

ID: 9829475
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.....

Expert Comment

ID: 9834272
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++

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.


Accepted Solution

guynumber5764 earned 50 total points
ID: 9852952
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.

Expert Comment

ID: 9855466
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!?:-))


Expert Comment

ID: 9855846
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. ;)


Expert Comment

ID: 9855890
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!!

Featured Post

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question