Question

My team and I are working on a pretty large project with many classes with their respective header and source files. We are trying to consolidate all includes from both C++ libraries and the projects class header files into one file called "Includes.h" which is included in every header file. One problem I have encountered when doing this is that the class header files are basically including themselves. I have included #pragma once at the top of every header file. When I comment out the #include "Controller.h" in the "#Includes.h" file, the errors for "Controller.h" go away.

Was it helpful?

Solution

Please Please Please and Pretty Please do not do this.

Prefer forward declarations. Then the individual include files.

Otherwise you change one include file and it has to compile the lot. I.e. waste of time.

Bascially get each header file to be able to compile with a blank cpp file. Minimum dependecies.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top