【错误记录】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 调试器附加进程时找不到