a linker error
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.
this probably means that you''ve #includ ''ed your header files more than once.
a good practice is to start each header file with:
This will help guard against multiple inclusions.
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.
I already did that, but for some reason it still wants to say that linker error.
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]
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]
"after many years of singularity, i'm still searching on the event horizon"
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement