代码之家  ›  专栏  ›  技术社区  ›  Ela782

如何在VS 2017上使用UNRealEngor 4.19启用C++ 17模式?

  •  1
  • Ela782  · 技术社区  · 7 年前

    /std:c++17 <optional> std::optional .

    我试着在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.
    

    #include <optional> 仍然会导致生成错误 fatal error C1189: #error: class template optional is only available with C++17. . 很难找到这方面的任何信息,甚至试图用UnrealBuildTool(UBT)调用的编译器标志来找出 cl.exe ... 建议补充的其他答案 -verbose 到nmake“Build Command Line”设置(所以我的命令行看起来像: "C:\Program Files\Epic Games\UE_4.19\Engine\Build\BatchFiles\Build.bat" DemoApp Win64 DebugGame "$(SolutionDir)$(ProjectName).uproject" -WaitMutex -FromMsBuild -verbose 但它所做的只是输出详细的UBT消息,而不是编译器命令行调用输出。

    0 回复  |  直到 7 年前