Archived

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

Project problems.

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

After a major rebuild of my project I get so damn many errors. I''ve got header includes all over that I can''t keep control over. So my first question is: do you have any good tips how to control the project? My second question is about classes and headers. Right now I put my classes like this in a header:
    class cApp
{
private:
   int var;
public:
   void func(void);
};    
Or should I put just a class declaration like class cApp; in my header and the declare the whole thing in a source file?

Share this post


Link to post
Share on other sites
well if you dont declare the class and its member functions in a header file then how are the other files supposed to know what functions are with the class.
If you just put
class myClass;
in the header file then the rest of the stuff in the .cpp file, when you try to use a member function of that class from another source file, then you will probably get some error refering to the file not knowing about a function (maybe something like uindeclared function or undeclared identifier)
just make sure you only include the header files that that particular .cpp file needs. If you arent sure which ones they each need, then comment out one include file at a time. If it compiles then you dont need that particular include file


"Now go away or I shall taunt you a second time"
- Monty Python and the Holy Grail
themGames Productions

Share this post


Link to post
Share on other sites
You only #include .h files, never include .cpp files

Add all the corresponding .cpp files to the .h files that you reference to your project (or .lib to your linker, if you dont have the .cpp)

you can also add the ultra crude

#ifndef __THIS_H
#define __THIS_H
//header code definitions go here
#endif

compiler directives to your headers just as you have them.

Edited by - Magmai Kai Holmlor on October 6, 2000 12:10:44 AM

Share this post


Link to post
Share on other sites