Problem
I am getting the following compilation error:
error: member access into incomplete type 'IRB'
This happens at the first line that class IRB
is used, at HG.h
.
Questions
What am I missing here? Is it the typedef that is causing the issues?
On each header file, as you can see below I forward declared the class that I am going to use.
More importantly what is the process that I should follow to get this correct?
Header files
T.h
typedef IRBBase__<true, true> IRB_BASE; // typedef a template instantiation
IRB.h
#include "T.h"
#include "FH.h"
class FH; // FWD DCLR
class IRB : IRB_BASE {..};
FH.h
#include "T.h"
#include "IRB.h"
#include "HG.h"
class IRB; // FWD DCLR
class HG; // FWD DCLR
class FH {..};
HG.h
#include "T.h"
#include "FH.h"
#include "IRB.h"
#include "CU.h"
class FH; // FWD DCLR
class IRB; // FWD DCLR
class CU; // FWD DCLR
class HG {..};
CU.h
#include "T.h"
#include "IRB.h"
#include "FH.h"
class IRB;
class FH;
class CU {..};
Edit: Got it working
After user0042 suggestion, I got it working by moving headers from all files except HG.h
into their respective .cc
files.
In HG.h
I kept the forward declarations, and the header files.