Can't compile 4.16 projects

I am trying to port a project from 4.14 to 4.16 and faced strange build errors. So I tried to build other projects and I found out I can’t compile any of the engine’s c++ templates (third person c++/first person/flying etc.)

with PCH (PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs) I get these 2 errors :

error C2855: command-line option '/Z7' inconsistent with precompiled header

error C2859: ...\SharedPCH.UnrealEd.h.pdb is not the pdb file that was used when this precompiled header was created, recreate the precompiled header.

With no PCH (PCHUsage = PCHUsageMode.NoSharedPCHs) I get this:

All source files in module "ModuleName" must include the same precompiled header first.
Currently "D:\Unreal Projects\ModuleName\Source\ModuleName\ModuleName.h" is included by most of the source files.
The following source files are not including "D:\Unreal Projects\ModuleName\Source\ModuleName\ModuleName.h" as their first include :

I get these same errors from all templates with no modifications.

Other projects compile fine in 4.14.

Using vanilla build of the engine. Both VS2015 and VS2017 generate the same errors.

Any idea what’s causing this ?

I figured out the cause of the problem.

In 4.14 I enabled the use of precompiled headers through the BuildConfiguration.xml file (Engine\Saved\UnrealBuildTool\BuildConfiguration.xml).

The buildConfig file of the 4.16 version of the engine was basically empty. So I added a rule that disabled PCH usage (false) and that fixed the problem.

For some obscure reason the unreal build tool was looking at the BuildConfiguration in the 4.14 folder untill I added a rule to the BuildConfiguration in the 4.16 folder.

I hope someone finds this useful.