• Advertisement

Archived

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

a linker error

This topic is 5618 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

I finally fixed my problem with my classes and .h files, but once i fixed it i now have linker errors saying that the functions i have in a file called functions.h are already defined in another .cpp files .obj. At the end it says "Debug/main.exe : fatal error LNK1169: one or more multiply defined symbols found". I found a site that tells me about his linker error, but i don''t get the solutions to fix it. The site I used was http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/lnk2005.asp i use this for most of my errors i don''t understand, but sometimes their solutions is over my head.

Share this post


Link to post
Share on other sites
Advertisement
this probably means that you''ve #includ ''ed your header files more than once.

a good practice is to start each header file with:


#ifndef THISHEADER_H //Reads, "If not Defined"
#define THISHEADER_H // Define:
//Header File goes here

#endif //endif


This will help guard against multiple inclusions.

Share this post


Link to post
Share on other sites
If you have something like "int g_someNum;" in your header, then that is the cause.

Make it "extern int g_someNum;" in your header and add "int g_someNum;" in ONE of the .cpp.





[edited by - DerekSaw on December 3, 2002 4:53:09 AM]

[edited by - DerekSaw on December 3, 2002 4:59:31 AM]

Share this post


Link to post
Share on other sites

  • Advertisement