Recommended Posts

So I've started writing my own project in C++. I was getting along quite well I thought, until I started to get compile errors with multiples of the same header files trying to be compiled. I took a closer look at my #include statements and came to a terrifying realization that it was a mess. A HUGE mess. I was amazed it had taken me that long to run into that error.

My question is; how do you keep track of your includes? What method works best? (eg. flow chart, string and bulletin board, white board, just a plain list....)

Also, what is the best way to create the hierarchy of includes, for example:

Lets say I have these files.
Bone, Mesh, Model, Entity, Manager, Updater, Main

Model relies on Mesh and Bone
Entity relies on Model
Manager relies on Mesh
Updater relies on Entity
Main relies on Manager, Updater.

What is the best way to include these files according to their individual dependencies?

I get stuck like this:
Model:
#include "Bone"
#include "Mesh"

Entity:
#include "Model"

Manager:
#include "Mesh"

Updater:
#include "Entity"

What now? What do I include in Main? I need both Updater and Manager, but if I include both, I've included Mesh twice!?