Error when compiling C++ after Visual Studio 2017 update

I have updated Visual Studio 2017 to version 14.6.4 and when trying to compile any UE4 project either from Visual Studio or UE4, the build fails with the following message:

1>------ Build started: Project: UE4, Configuration: BuiltWithUnrealBuildTool Win32 ------
2>------ Build started: Project: Onire, Configuration: Development_Editor x64 ------
2>Performing 3 actions (4 in parallel)
2>UnrealBuildTool : error : Failed to start local process for action: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\bin\HostX64\x64\cl.exe  @"B:\Users\Pedro\Documents\Unreal Projects\OnireWorkspace\Project\Onire\Intermediate\Build\Win64\UE4Editor\Development\Onire\Lumi.cpp.obj.response"
2>UnrealBuildTool : error : System.ComponentModel.Win32Exception (0x80004005): El sistema no puede encontrar el archivo especificado
2>                           en System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
2>                           en UnrealBuildTool.ActionThread.ThreadFunc() en D:\Build\++UE4+Release-4.19+Compile\Sync\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\System\LocalExecutor.cs:línea 228
2>UnrealBuildTool : error : UBT ERROR: Failed to produce item: B:\Users\Pedro\Documents\Unreal Projects\OnireWorkspace\Project\Onire\Binaries\Win64\UE4Editor-Onire.dll
2>Total build time: 0,98 seconds (Local executor: 0,00 seconds)
2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets(44,5): error MSB3075: The command ""C:\Program Files\Epic Games\UE_4.19\Engine\Build\BatchFiles\Build.bat" OnireEditor Win64 Development "B:\Users\Pedro\Documents\Unreal Projects\OnireWorkspace\Project\Onire\Onire.uproject" -WaitMutex -FromMsBuild" exited with code 5. Please verify that you have sufficient rights to run this command.
2>Done building project "Onire.vcxproj" -- FAILED.
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I have tried reinstalling Visual Studio and repairing, but it didn’t help.
I indeed have a cl.exe executable, but it is in another folder: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\bin\Hostx64\x64 instead of C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\bin\HostX64\x64\cl.exe.


I think Visual Studio has changed the folder name, but UE4 is still looking for the old one. So I created a symbolic link
( mklink /D "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827" "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128" ) with the folder UE4 expects pointing to the folder where cl.exe lives. That way UE4 finds cl.exe, but the compilation fails with another message:

1>------ Build started: Project: UE4, Configuration: BuiltWithUnrealBuildTool Win32 ------
2>------ Build started: Project: Onire, Configuration: Development_Editor x64 ------
2>Performing 3 actions (4 in parallel)
2>Lumi.cpp
2>B:\Users\Pedro\Documents\Unreal Projects\OnireWorkspace\Project\Onire\Source\Onire\Private\Characters\Lumi.cpp : fatal error C1853: 'C:\Program Files\Epic Games\UE_4.19\Engine\Intermediate\Build\Win64\UE4Editor\Development\Engine\SharedPCH.Engine.h.pch' precompiled header file is from a previous version of the compiler, or the precompiled header is C++ and you are using it from C (or vice versa)
2>UnrealBuildTool : error : UBT ERROR: Failed to produce item: B:\Users\Pedro\Documents\Unreal Projects\OnireWorkspace\Project\Onire\Binaries\Win64\UE4Editor-Onire.dll
2>Total build time: 1,02 seconds (Local executor: 0,00 seconds)
2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets(44,5): error MSB3075: The command ""C:\Program Files\Epic Games\UE_4.19\Engine\Build\BatchFiles\Build.bat" OnireEditor Win64 Development "B:\Users\Pedro\Documents\Unreal Projects\OnireWorkspace\Project\Onire\Onire.uproject" -WaitMutex -FromMsBuild" exited with code 5. Please verify that you have sufficient rights to run this command.
2>Done building project "Onire.vcxproj" -- FAILED.
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

What should I do? I have only updated Visual Studio from the Visual Studio installer.

Thank you.

Compiler complains about version incompatibility of precompiled headers since you updated VS. First try to rebuild your project (deletes all object files and compiles entire code from 0) if this does not work delete Intermidiate directory in your project file and regenerate project files (Without it you wont be able to open VS projects as they generated in directory i mentioned). Simply you need to make compiler recompile precompiled header files.

Since error comes from engine source, there possibility that you will need to compile engine from source or wait for UE4 update with new precompiled headers or even try to revert VS update until that update comes.

Yes, but the precomputed header is in the UE4 installation Intermediate folder. How can I recompile that headers, should I recompile the engine for source? And should I keep the symbolic link hack?
Do you know anywhere I can point this issue to Epic themselves, so they can update with precomputed headers?
Thanks

Thanks a simple Rebuild did wonders :slight_smile: Cheers