We are using Visual Studio 2013 at work and I have recently come across a problem I haven't seen before.
We have a project with some COM definitions in an _i.c file. The problem is when we added two configurations to the projects and solution, instead of these configurations being independent they seem to be tied, but only within the precompiled header settings which are meant to be overriding the project behaviour for this file.
Originally there were two configurations in the Project and Solution, which were Debug and Release.
These were MCBS builds. Recently we needed additional Unicode versions, so now there are 4 configurations Debug, Release, Debug-UNICODE, Release-UNICODE.
The global project setting for the C++ Precompiled Header files is "Use (/Yu)" this is true for both the original Debug and Release configuration (and now the new ones too)
Then the _i.c file has a specific setting of "Not Using Precompiled Headers" again this is true in the original Debug and Release configurations.
Now that we have added these other two configurations when you attempt to build them when the build gets to the _i.c file you either get told a) that the precompiled header file is from a previous version of the compiler, or b) that the compiler failed to find stdafx.h
However the file isn't supposed to be using the precompiled headers according to the project setting for this file (as presented by the IDE), yet it is attempting to do so.
Note worthy is the fact that when you change the files setting under the Release Configuration, you notice that the Release-UNICODE has now changed as well to the same setting (and vice versa). The same is true for Debug and Debug-UNICODE.
The [X]-UNICODE configurations where created as copies of the [X] configurations, but they aren't meant to be shared. All other settings other than precompiled headers do stay independent.
Also if you look at the saved project under the _i.c file it does not actually have all the configurations listed
<ItemGroup>
...
<ClCompile Include="<filename>_i.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug-UNICODE|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release-UNICODE|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
...
If you ignore the IDE, the project is building correctly according to whats in the .vcxproj file, the trouble is the IDE fails to write it correctly