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?
Project problems.
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:
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
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
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
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
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement