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.

Était-ce utile?

La 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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top