#include problems
-
Hi everyone, I've some problems including header files. I have 2 classes COne and CTwo, and COne implements CTwo objects, so I put an include CTwo statement in COne.h. Both classes must use some functions declared in a Myheader.h file. Including Myheader in both .cpp or .h files produces linking error, and the same does including Myheader.h in CTwo.h to exploit the inheritance of the include statement. The error is LNK1169: one or more multiply defined symbol founds. Any suggestion?
-
Hi everyone, I've some problems including header files. I have 2 classes COne and CTwo, and COne implements CTwo objects, so I put an include CTwo statement in COne.h. Both classes must use some functions declared in a Myheader.h file. Including Myheader in both .cpp or .h files produces linking error, and the same does including Myheader.h in CTwo.h to exploit the inheritance of the include statement. The error is LNK1169: one or more multiply defined symbol founds. Any suggestion?
Did you put these statements in all of your *.h files :
#if !defined YOURFILENAME #define YOURFILENAME //Declaration of your class ... ... ... #endif
Replace YOURFILENAME by something unique to every file. -
Did you put these statements in all of your *.h files :
#if !defined YOURFILENAME #define YOURFILENAME //Declaration of your class ... ... ... #endif
Replace YOURFILENAME by something unique to every file. -
Hi everyone, I've some problems including header files. I have 2 classes COne and CTwo, and COne implements CTwo objects, so I put an include CTwo statement in COne.h. Both classes must use some functions declared in a Myheader.h file. Including Myheader in both .cpp or .h files produces linking error, and the same does including Myheader.h in CTwo.h to exploit the inheritance of the include statement. The error is LNK1169: one or more multiply defined symbol founds. Any suggestion?
Hello You should not include Myheader.h in both the files. You can include the Myheader.h in CTwo.h and include CTwo.h in COne.h I hope it would work... Bye, Sreekanth Muralidharan ;)
-
Hello You should not include Myheader.h in both the files. You can include the Myheader.h in CTwo.h and include CTwo.h in COne.h I hope it would work... Bye, Sreekanth Muralidharan ;)