OK I answered my own question:
I had been looking at Engine C++ files in Visual Studio and had accidentally changed one of the header files and didn’t realize that these files were the main source files. So I corrected a tiny mistake in the one file shown in the error message - TranslationUnit.h. It had a comment slash missing.
Using UE version 4.16.1 on Windows 10 I try to create a blank C++ project but it crashes every time with the following error message:
The project could not be compiled. Would you like to open it in Visual Studio?
Running C:/Program Files/Epic Games/UE_4.16/Engine/Binaries/DotNET/UnrealBuildTool.exe CplusGetError Development Win64 -project=“C:/Users/Will/Documents/Unreal Projects/CplusGetError/CplusGetError.uproject” -editorrecompile -progress -NoHotReloadFromIDE
Performing full C++ include scan (building a new target)
Creating makefile for CplusGetError (no existing makefile)
@progress push 5%
Parsing headers for CplusGetErrorEditor
Running UnrealHeaderTool “C:\Users\Will\Documents\Unreal Projects\CplusGetError\CplusGetError.uproject” “C:\Users\Will\Documents\Unreal Projects\CplusGetError\Intermediate\Build\Win64\CplusGetErrorEditor\Development\CplusGetErrorEditor.uhtmanifest” -LogCmds=“loginit warning, logexit warning, logdatabase error” -Unattended -WarningsAsErrors -installed
C:/Program Files/Epic Games/UE_4.16/Engine/Source/Editor/TranslationEditor/Private/TranslationUnit.h(117) : Error: Expected an include at the top of the header: ‘#include “TranslationUnit.generated.h”’
Error: UnrealHeaderTool failed for target ‘CplusGetErrorEditor’ (platform: Win64, module info: C:\Users\Will\Documents\Unreal Projects\CplusGetError\Intermediate\Build\Win64\CplusGetErrorEditor\Development\CplusGetErrorEditor.uhtmanifest, exit code: OtherCompilationError (5)).