Jump to content
  • Advertisement
Sign in to follow this  
RobinOfSweden

Unresloved external symbols???

This topic is 4237 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! I have declared some function declarations "before" the main function like this: void story(void); void instr(void); void question1(void); and then I have the actual functions "after" the main function like this: int main () { story(); ending(); return 0; } void story(void) { instr(); question1(); question2(); question3(); question4(); question5(); question6(); question7(); question8(); question9(); question10(); } void question2(void) { } But when I compile I get plenty of these errors: 1>main.obj : error LNK2001: unresolved external symbol "void __cdecl question2(void)" (?question2@@YAXXZ) Whats wrong? Thanks/

Share this post


Link to post
Share on other sites
Advertisement
If that is C++ code, then that's not all your code because it would not compile. Post all of your code.

I suspect, however, that you're actually compiling C code (file extension .c or .C or you've forced C compilation via the command line). In that case, you're getting linker errors because the compiler is assuming implicit definitions of functions that either mismatch later (question2() will be assumed to return int the first time it is seen in story(), later when you define it it will not return int, so there is a mismatch. This causes a warning on most compilers, perhaps you have suppressed or ignored them.

Then, you fail to link because the linker was unable to find definitions for all the functions that needs to (all the ones the compiler implicitly assumed existed elsewhere).

You need to provide definitions for your functions.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!