Archived

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

MV

vc6 Include problem

Recommended Posts

MV    122
Hi guys, I''ve got a little problem that starts to be really boring. With vc6 using multiple source files, I sometime have "undefined class" messages while compiling. I can''t figure out why, since I''ve got the good headers included. I can use pointers with a class ...; instruction before my class definition but this is not a solution cause I cant derive classes with this method. In my case, I need to derive and I cant, so I''m stucked ! Please help !!!

Share this post


Link to post
Share on other sites
WebsiteWill    134
Instead of including class definition in a .h file and the class specification (actual functions) in a .cpp (or other) file you will need to include all of the code in the same file (preferrably a .h file).

Surround all of the code in your .h''s with the
#ifndef CLASS_NAME
#define CLASS_NAME

#endif //CLASS_NAME
doo dads and then you can include your .h files anywhere necessary and they will work just fine, even for inheritance. I struggled with this a few weeks back because VC++ seems to handle such tasks differently from the GCC I was used to on the Unix systems I delevoped on in college.

Hope this helps,
Webby

Share this post


Link to post
Share on other sites
MV    122
Thanks for your post !
Actually I solved my problem ; I tryed to derivate one class from 2 classes with one beeing derivated from the second one ( class A : public B,C {...}; with class B : public C {...} :D )

BUT, I still have troubles with includes. I use the #ifndef ... #define mechanism, but I still separate headers from source files.
You think I have to include the source with the header ? That''s a bit sad, cause I miss the completion functionnalties of VC6.

Share this post


Link to post
Share on other sites