【错误记录】Visual Studio 中编译 NDK 报错 ( error : cannot use ‘throw‘ with exceptions disabled )
生活随笔
收集整理的这篇文章主要介绍了
【错误记录】Visual Studio 中编译 NDK 报错 ( error : cannot use ‘throw‘ with exceptions disabled )
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
文章目录
- 一、报错信息
- 二、解决方案
一、报错信息
使用 Visual Studio 2019 编译 Android NDK 项目 , 报错如下 :
已启动生成… 1>------ 已启动生成: 项目: native, 配置: Debug ARM ------ 1>ANDROID_HOME=D:\\Microsoft\AndroidSDK\25 1>ANT_HOME=D:\001_Develop\017_Microsoft Visual Studio\2019\Community\Apps\apache-ant-1.9.3 1>JAVA_HOME=C:\Program Files\Android\jdk\microsoft_dist_openjdk_1.8.0.25 1>NDK_ROOT=D:\\Microsoft\AndroidNDK64\android-ndk-r16b 1>json_reader.cpp 1>json\json_reader.cpp(1129,14): error : cannot use 'throw' with exceptions disabled 1> if (!ok) throw std::runtime_error(reader.getFormatedErrorMessages()); 1> ^ 1>1 error generated. 1>已完成生成项目“native.vcxproj”的操作 - 失败。 ========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========二、解决方案
在项目属性中设置 " 启动 C++ 异常 " 项为 " 是 ( -fexception ) " 选项 ;
如果使用 Android.mk 构建项目 , 可以添加 LOCAL_CPP_FEATURES += exceptions 或 LOCAL_CPPFLAGS += -fexceptions 配置 ;
也可以在 Application.mk 中配置 APP_CPPFLAGS += -fexceptions ;
总结
以上是生活随笔为你收集整理的【错误记录】Visual Studio 中编译 NDK 报错 ( error : cannot use ‘throw‘ with exceptions disabled )的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 【Android 逆向】函数拦截实例 (
- 下一篇: 【错误记录】OD 调试器附加进程时找不到