What is the proper way to use stdafx.h
, in terms of separating dependencies?
If I put everything in there, then my compiles are blazing fast, and all I need to say in any file is
#include "stdafx.h"
with the caveats that:
- I no longer know which files depend on which headers.
- It reduces modularity, making my code less reusable.
- I can no longer separate C
#include
s from C++ ones (e.g.cstring
versusstring.h
) without a great deal of pain. (Speaking of which, does this even matter?)
If I put nothing in there, I can organize everything well -- but then my compiles slow down dramatically.
If I put everything in there and also include every header in my individual files, then I get the best of both worlds, with the caveat that now I have to keep track of synchronization issues.
Is there a well-known/well-accepted solution to this problem?