Hi,
I am having difficulties enabling c++17 for my project. I am on Linux and have the engine (4.24.3-release) compiled from source.
I can reproduce this problem very simply with the following steps:
- create a new blank c++ project without starter content (named “MyProject”)
- insert
CppStandard = CppStandardVersion.Cpp17;
in Source/MyProject/MyProject.Build.cs as the first line in the constructor
3. run “make MyProjectEditor” which leads to a compile error “error: C++17 was disabled in PCH file but is currently enabled”
To solve this problem, I have tried the following approaches:
rm -rf Binaries Intermediate && make MyProjectEditor
but this lead to the same error
- from https://forums.unrealengine.com/development-discussion/c-gameplay-programming/1603585-what-s-needed-for-using-c-17
replace the constructor in Source/MyProject/MyProject.Build.cs with
and create an empty file "Source/MyProject/PCH_MyProject.h"
then run
rm -rf Binaries Intermediate && make MyProjectEditor
but this lead to the same error
- from https://forums.unrealengine.com/development-discussion/c-gameplay-programming/1612347-issues-with-4-22-c-17-support
do the same as in 2. but additionally insert in Source/MyProjectEditor.Target.cs the line
BuildEnvironment = TargetBuildEnvironment.Unique;
then run
rm -rf Binaries Intermediate && make MyProjectEditor
which causes 1450 files being recompiled
but leads to the same error in the end
- from Unreal Engine 4: Compiling and packaging Android application problem summary - Programmer Sought where there is a proposed solution for the error “exception handling was disabled in PCH file but is currently enabled” which seems very similar to mine
in Engine\Source\Programs\UnrealBuildTool\Platform\Linux\LinuxToolChain.cs remove the line
PCHArguments += string.Format(" -include \"{0}\"", InlineArchName(BasePCHName, Arch, GPUArchitecture))
then run
rm -rf Binaries Intermediate && make MyProjectEditor
but this lead to the same error
At this point I have no idea what I am doing wrong and what else I could try. Thank you for your help.