Solved

Unresolved Symbol

Posted on 2003-11-26
7
255 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
7 Comments
 
LVL 45

Expert Comment

by:Kdo
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 3

Accepted Solution

by:
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.
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

706 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now