Package project for Android got error with C++ standard Cpp17

I add a third-party entt which was writed by c++17.

my Build.cs file like this:

PublicIncludePaths.Add(ThirdPartyPath + "entt");

my Target.cs file like this:

DefaultBuildSettings = BuildSettingsVersion.V2;
bOverrideBuildEnvironment = true;
CppStandard = CppStandardVersion.Cpp17;

Build sucessed by Shipping Server, Shipping Client , Debug Editor, Development Editor.

But got errors when pakage Android:

UATHelper: Packaging (Android (ETC2)): E:/Legendary/Xiuxian/Source/ThirdParty/entt/core/utility.hpp(54,30): warning: pack expansion of using declaration is a C++17 extension [-Wc++17-extensions]

UATHelper: Packaging (Android (ETC2)): using Func::operator()…;

UATHelper: Packaging (Android (ETC2)): E:/Legendary/Xiuxian/Source/ThirdParty/entt/core/utility.hpp(63,1): error: C++ requires a type specifier for all declarations

UATHelper: Packaging (Android (ETC2)): overloaded(Func…) → overloaded;

I solved the problem by modify \Engine\Source\Programs\UnrealBuildTool\Platform\Android\AndroidToolChain.cs

Change two places:

//Result += " -std=c++14";
Result += " -std=c++17";

I think UE4 misses out supporting c++17 for android ndk compiling.
Hope official fix.

1 Like