Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

remi

unresolved external

This topic is 5937 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
if you write this somewhere in your code:

extern void foo(int i);

and this function doesnt exist, then you will get an "unresolved external" linker error. the same for variables, too. but the actual answer is hard to tell without viewing your code....

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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!!!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!