• Advertisement

Archived

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

vc6 Include problem

This topic is 5255 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 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
Advertisement
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
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

  • Advertisement