title: Sharing precompiled headers between projects in Visual Studio
body: <p>I have a solution with many Visual C++ projects, all using PCH, but some have particular compiler switches turned on for project-specific needs.</p>
  
  <p>Most of these projects share the same set of headers in their respective stdafx.h (STL, boost, etc). I'm wondering if it's possible to share PCH between projects, so that instead of compiling every PCH per-project I could maybe have one common PCH that most projects in the solution could just use.</p>
  
  <p>It seems possible to specify the location of the PCH as a shared location in the project settings, so I have a hunch this could work. I'm also assuming that all source files in all projects that use a shared PCH would have to have the same compiler settings, or else the compiler would complain about inconsistencies between the PCH and the source file being compiled.</p>
  
  <p>Has anyone tried this? Does it work?</p>
  
  <p>A related question: should such a shard PCH be overly inclusive, or would that hurt overall build time? For example, a shared PCH could include many STL headers that are widely used, but some projecst might only need <code>&lt;string&gt;</code> and <code>&lt;vector&gt;</code>. Would the time saved by using a shared PCH have to be paid back at a later point in the build process when the optimizer would have to discard all the unused stuff dragged into the project by the PCH?</p>