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:
fatal error C1014: too many include files : depth = 1024
fatal error C1014: too many include files : depth = 1024
Here is some example code of my program:
Header file (the class interface) 'Base.h' :
Code:
#include "Base.cpp"
class Base
{
public:
Base(int x);
private:
int x_;
};
Class implementation 'Base.cpp' :
Code:
#include "Base.h"
Base::Base(int x)
{
val_ = x;
}
main.cpp :
Code:
#include <iostream>
#include "Base.h"
using namespace std;
int main()
{
Base b1(2);
system ("PAUSE");
return 0;
}
I understand that using:
Code:
#ifndef FILENAME.H
#define FILENAME.H
//Header file code here
#endif
Is often a way to solve this problem, but unless I'm mistaken, this is not required for my program.
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!