AchillesHeart
AchillesHeart

Reputation: 1

Enable exceptions and rtti in NDK v26.2

I have a problem with building a project in android studio that uses ndk v26.2. When the process is trying to build the c++ code, it seems to use the -fno-exceptions anf -fno-rtti flags by default. Becuase, I have "try... catch" statements in my code, the build fails.

I tried the following: add -fexceptions flag in the CMakeLists.txt :

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions")

add -fexceptions flag in the build.gradle file:

externalNativeBuild {
            cmake {
                cppFlags.addAll(["-fexceptions"])
            }
  }

None of the above work, because in the build command the -fno-exceptions flag shows up after -fexpections

Your help is appreciated

Upvotes: 0

Views: 36

Answers (0)

Related Questions