UnrealEngine 4.19 uses Visual Studio 2017's C++14 mode as default. The Visual Studio 2017 compiler has a flag /std:c++17
to enable C++17 and subsequently things like <optional>
for std::optional
.
I tried adding the following line to VCToolChain.cs (C:\Program Files\Epic Games\UE_4.19\Engine\Source\Programs\UnrealBuildTool\Platform\Windows\VCToolChain.cs
):
void AppendCLArguments_Global(CppCompileEnvironment CompileEnvironment, VCEnvironment EnvVars, List<string> Arguments)
{
Arguments.Add("/std:c++17");
// ... the rest of this function.
However this doesn't seem to do anything, for example #include <optional>
still results in the build error fatal error C1189: #error: class template optional is only available with C++17.
.
It's immensely difficult to find out anything about this or even try to find out with that compiler flags the UnrealBuildTool (UBT) is calling cl.exe
... Other answers suggested to add -verbose
to the nmake "Build Command Line" setting (so mine looks like: "C:\Program Files\Epic Games\UE_4.19\Engine\Build\BatchFiles\Build.bat" DemoApp Win64 DebugGame "$(SolutionDir)$(ProjectName).uproject" -WaitMutex -FromMsBuild -verbose
but all it does is output verbose UBT messages, not compiler command-line invocation output.