Enable Exception C++

后端 未结 8 637
醉梦人生
醉梦人生 2021-01-01 13:00

I am trying to make APP native code for Android. The Native code is in cplusplus. Whenever I try to make, the following error appears.

H236Plus.cpp:13

相关标签:
8条回答
  • 2021-01-01 13:25

    Refer this answer by @Tundebabzy if you are using ndk-build build system.

    For CMake build system

    add the following to your module-level build.gradle file:

    android {
      ...
      defaultConfig {
        ...
        externalNativeBuild {
    
          // For ndk-build, instead use ndkBuild {}
          cmake {
            // Enables exception-handling support.
            cppFlags "-fexceptions"
          }
        }
      }
    }
    ...
    

    For more information See this Link.

    0 讨论(0)
  • 2021-01-01 13:29

    Just a note for anyone who has started with one of the NDK examples.

    They tend to set -fno-exceptions in their CMakeLists.txt, you need to remove it:

    set(CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -Wall -Werror -fno-exceptions -frtti") 
    

    You might want to check whether you want -Werror while you're at it.

    0 讨论(0)
提交回复
热议问题