You have a cycle in your header inclusion:
MainProgram.hincludesFileMgr.hFileMgr.hincludesMgrBase.hMgrBase.hincludesMainProgram.h
You need to break this cycle using forward declarations.
The rule in header files should be: if you only need to declare reference or pointer to a type X, forward declare X instead of including the header which defines it. The same applies if you’re declaring (not defining) a function which has a parameter or return value of type X.
You only have to include the full definition of X if you’re accessing members of X or defining a class derived from X.
In your case:
- Move both
#includestatements fromMainProgram.htoMainProgram.cpp - Remove
#include "MainProgram.h"fromMgrBase.h
0
solved Why isn’t C++ inheritance in multiple header and source files working?