[Android] error : cannot use 'throw' with exceptions disabled

Hi, I just try to integrate a thirdparty library into my project, the library need to enable exception support, so I add following line to my build.cs:
bEnableExceptions = true;
UEBuildConfiguration.bForceEnableExceptions = true;

it works fine on windows, but when I try to build it to my android device, it emit compile error with error message:
error : cannot use ‘throw’ with exceptions disabled

I trace down into UBT code, and find out in AndroidToolChain.cs, it define -fno-exceptions for all android architecture.

Is it possible to enable exception without modify engine source code?

I find out it can add -fexceptions to CompileEnvironment.Config.AdditionalArguments, but I don’t know how to add this in my build.cs.

Any suggestion will be appreciated.


Hey dorgon,

I recommend taking a look at the thread linked below as it provides more information on how UE4 handles exceptions.

Have a great day

Hi, thanks for your reply.

I decide to fork engine to modify UBT in order to integrate thirdparty library that I want to use.