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:
#include
s from C++ ones (e.g. cstring
versus string.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?
You shouldn't put your own header files in stdafx.h
since your code is likely to change and will cause your whole program to recompile.
I usually put standard headers and other libraries in there, such as all boost includes.