I have a header problem, when trying to #include 2 different files. Here's my problem:
Header B:Code:#ifndef HEADER_A #define HEADER_A #include "headerB.h" <class function definitions go here> <one function requires class structure from header b> #endif
Now, when I do this, header A tries to include B, but B needs to include header A first. But thats fine, there won't be any redefinition of functions problem, because I put the #ifndef HEADER_* in there. But what is a problem is that Header A never includes the class structure from Header B, because before it can read its class structure, it has to include A because it needs to know its class structure for the one function that requires that information. So the compiler completely skips the class structure in B, preventing the class structure in A from being defined. So my code won't compile.Code:#ifndef HEADER_B #define HEADER_B #include "headerA.h" <class function definitions go here> <one function requires class structure from header a> #endif
Any suggestions on how to get around this, if there is a way?