Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Unresolved Symbol

Posted on 2003-11-26
7
Medium Priority
?
261 Views
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!
0
Comment
Question by:Drake009
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 46

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.

Kent
0
 
LVL 8

Expert Comment

by:ssnkumar
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.....
0
 
LVL 3

Expert Comment

by:gmleeman
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"
{
#endif

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


#ifdef __cplusplus
}
#endif

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++


0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Accepted Solution

by:
guynumber5764 earned 150 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.
0
 
LVL 8

Expert Comment

by:ssnkumar
ID: 9855466
guynumber5764,
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!

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

-ssnkumar
0
 
LVL 3

Expert Comment

by:guynumber5764
ID: 9855846
ssnkumar,
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.

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

E.
0
 
LVL 8

Expert Comment

by:ssnkumar
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!!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

610 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