It's easy to do this in Xcode, but not quite so in Visual Studio.
The concepts are the same, but in Visual Studio, there are only two options for precompiled headers:
- Use Precompiled Header (/Yu); and
- Create Precompiled Header (/Yc)
So, you can use one (only after you've made it), or you can make it again and again and again....
So how do the VS templates achieve the desired behaviour of building the precompiled headers once, and automatically updating them if any of the header files change??
The entire project is set to "Use Precompiled Headers", except for one file where the build properties are changed: "stdafx.cpp" This file is set to "Create Precompiled Headers". This file contains no code, but includes the header files. So when the header files change, it needs to be recompiled, which creates new precompiled headers.
Seems like a kludgy workaround kind of way to achieve what you want, but once you know how it works, it works.