【错误记录】Visual Studio 中编译 NDK 报错 ( error : cannot use ‘throw‘ with exceptions disabled )
生活随笔
收集整理的這篇文章主要介紹了
【错误记录】Visual Studio 中编译 NDK 报错 ( error : cannot use ‘throw‘ with exceptions disabled )
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
文章目錄
- 一、報(bào)錯(cuò)信息
- 二、解決方案
一、報(bào)錯(cuò)信息
使用 Visual Studio 2019 編譯 Android NDK 項(xiàng)目 , 報(bào)錯(cuò)如下 :
已啟動(dòng)生成… 1>------ 已啟動(dòng)生成: 項(xiàng)目: 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>已完成生成項(xiàng)目“native.vcxproj”的操作 - 失敗。 ========== 生成: 成功 0 個(gè),失敗 1 個(gè),最新 0 個(gè),跳過 0 個(gè) ==========二、解決方案
在項(xiàng)目屬性中設(shè)置 " 啟動(dòng) C++ 異常 " 項(xiàng)為 " 是 ( -fexception ) " 選項(xiàng) ;
如果使用 Android.mk 構(gòu)建項(xiàng)目 , 可以添加 LOCAL_CPP_FEATURES += exceptions 或 LOCAL_CPPFLAGS += -fexceptions 配置 ;
也可以在 Application.mk 中配置 APP_CPPFLAGS += -fexceptions ;
總結(jié)
以上是生活随笔為你收集整理的【错误记录】Visual Studio 中编译 NDK 报错 ( error : cannot use ‘throw‘ with exceptions disabled )的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【Android 逆向】函数拦截实例 (
- 下一篇: 【Android 逆向】函数拦截实例 (