I would only use option 1 in a large development team. Options 2, 3, and 4 often halt the performance of other members of your team, so you can save several minutes a day during compilation.
That's why:
Suppose half of your developers use VS and half use gcc. From time to time, some VS developer will forget to include the header in the .cpp file. It will not notice, because stdafx.h implicitly includes it. This way it pushes its changes to version control, and then several other members of the gcc team will get compiler errors. Thus, for every 5 minutes a day you get, using pre-compiled headers, 5 other people spend time correcting the missing headers.
If you do not use the same code for all your compilers, you will encounter such problems every day. If you force VS developers to check compilation on gcc before pushing changes, you will throw away all your benefits from using precompiled headers.
Option 4 sounds attractive, but what if you want to use a different compiler at some point? Option 4 only works if you use only VS and gcc.
Note that option 1 can make gcc compile for a few seconds. Although this may not be noticeable.
Grim Fandango Sep 07 '14 at 6:35 2014-09-07 06:35
source share