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