Just to clarify, you have two problems here:
1) Multiple inclusion - the possibility of the same header file being included twice in the same translation unit (i.e. the same .cpp file).
This is fixed by the solution in Bourgond's post. Whenever you're writing a header file, you should ALWAYS do this. Only don't use "included" as the name of the symbol - the name has be unique to the header file. Normally, people include the name of the header file in the symbol, so, for example, if the file is MyClassA.h, you'd have;
1 2 3 4
|
#ifndef MYCLASSA_H_INCLUDED
#define MYCLASSA_H_INCLUDED
// Code here
#endif
|
2) Recursive dependency - class A depends on class B, which depends on Class A.
This usually indicates your design isn't right. ajh32's post addresses this issue. In the code you posted, Files doesn't actually depend on the definition of MyClass, as it's only using a pointer to it. space.h therefore doesn't need to include MyClass.h - it just needs to forward-declare the MyClass is a class.