Hi there,
Up until now I've only ever used a main.cpp file and a class.h header file, but am trying to improve my separating of class interface and implementation.
I have the following problem though:
Here is some example code of my program:fatal error C1014: too many include files : depth = 1024
fatal error C1014: too many include files : depth = 1024
Header file (the class interface) 'Base.h' :
Class implementation 'Base.cpp' :Code:#include "Base.cpp" class Base { public: Base(int x); private: int x_; };
main.cpp :Code:#include "Base.h" Base::Base(int x) { val_ = x; }
I understand that using:Code:#include <iostream> #include "Base.h" using namespace std; int main() { Base b1(2); system ("PAUSE"); return 0; }
Is often a way to solve this problem, but unless I'm mistaken, this is not required for my program.Code:#ifndef FILENAME.H #define FILENAME.H //Header file code here #endif
The problem is me not understanding how to correctly include the files amongst one another.
So I was hoping someone could tell me my error so that I get this all correct, ie: which #includes are required and which are not.
Many thanks!



LinkBack URL
About LinkBacks


