Suppose I have several "h" files:
First.h
struct FirstStruct { /* Stuff */ };
/* Other stuff */
Second.h
#include "First.h"
struct SecondStruct {
FirstStruct member;
/* More other stuff */
};
/* Even more other stuff */
Third.h:
#include "Second.h"
FirstStruct foo(void);
/* Other functions */
If you notice Third.h
does not get the definition of the FirstStruct directly (ie from including First.h), but because Second.h includes it for it. The problem is that when a developer decides that SecondStruct
does not really need that FirstStruct
in there it needs the semi equivalent struct OtherStruct
, and then takes out the include to First.h......oops now anything using Third.h
doesn't work.
Is there any semi standard compiler option to warn you if you are relying on another h files include?