What's needed for using C++17

If you modify the UnrealBuildTool, you can also use the PCH. I ran into the same issue with c++20 now (September 2020), and this is obviously a horrible hackish way to do it, but since I spent 3 hours R&Ding it, I might as well post it here:

  • Open the VS project UE_4.25\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj
  • Depending on which .NET SDK is intalled on your machine, you might need to change the target framework
  • Find the file Platform\Windows\VCToolChain.cs in that solution
  • Go to the end of the method AppendCLArguments_Global (it’s around line 537 at the time of writing)
  • Add

Arguments.Add("/std:c++latest");

there, or whatever c++ standard you want the compiler to use

  • build the solution. It should build to UE_4.25\Engine\Binaries\DotNET\UnrealBuildTool.exe

Now build your game project with the build settings set to:


PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
CppStandard = CppStandardVersion.Latest;

1 Like