Skip to main content
gamedev.net
🔒 Locked

unresolved external

Started by remi Apr 17, 2002 at 8:57 AM 5 replies 250+ views
Original Post
remi
remi
Hi all, i know when u don''t link some Dll files in your project,like ddraw.lib, the compiler may complain for unresolved external. But now, the unresolved external i have has nothing to do with Dll files, it''s about an object i declared myself... Well, what i want is not that u help me write my codes,NO. What i need to know is what can be the causes of Unresolved externals(causes that are not related to linkage with Dlls). Please man, if my question sounds stupid don''t flame, just let me know, and apologize for grammatical mistakes :p Anyhelp???
"...and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces."----------Scott Meyers, "Effective C++"
remi
remi
thanks anonymous poster,
i will try to check that. I really apologize not to be able to post the code here cause it has too many files.....u see what i mean.
"...and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces."----------Scott Meyers, "Effective C++"
Gabriel Fleseriu
Gabriel Fleseriu
Quote from MSDN, for this error:
====
Code will generate this error message if it references something (like a function, variable, or label) that the linker can’t find in all the libraries and object files it searches. In general, there are two reasons this error occurs: what the code asks for doesn’t exist (the symbol is spelled incorrectly or uses the wrong case, for example), or the code asks for the wrong thing (you are using mixed versions of the libraries?some from one version of the product, others from another version).
====

This si a (simplified) explanation of what''s going on:

When you compile a module (that is, a .cpp file), you use certain functions and variables that are not defined in this module. By adding the proper .h files, you add the prototipes for this entities. This is like a promise you make to the compiler: "this function isn''t here, but it will be in some other module". When the linker puts the modules together, it will try to "resolve" all this "promises". If it cannot find some variable or function you used in any module, it will throw this error.

It is likely that you declared some variable as "extern" in a .h file, but didn''t define it in a .cpp file (i.e. without "extern").

HTH,

Gabriel

Forever trusting who we are
And nothing else matters
- Metallica
Forever trusting who we areAnd nothing else matters - Metallica
remi
remi
thanx Gabriel Fleseriu,
i gad ur point,....and i tried to look around, but i don''t find any case of "extern variables" that are not declared in the .cpp file.
But what i find strange is that,uhmm...look at what the compiler said:

  Linking...
block.obj : error LNK2001: unresolved external symbol "public: __thiscall BLOCK::~BLOCK(void)" (??1BLOCK@@QAE@XZ)
Debug/POPOW.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.


but the constructor of the class BLOCK have been defined in my codes.
BIZARRE!!!
"...and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces."----------Scott Meyers, "Effective C++"
jenova
jenova
yeah, but the destructor hasn''t....

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
remi
remi
o yah,u''r write!
thanx all.
"...and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces."----------Scott Meyers, "Effective C++"

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.