cannot use 'throw' with exceptions disabled(转)
在为 DragonBonesCPP/refactoring 的 cocos2d-x-3.2 demo 增加 Android 编译时,NDK 报了一个编译错误:
error: cannot use ‘throw’ with exceptions disabled
throw std::invalid_argument(“Invalid data.”);
这是由于 DragonBonesCPP 库使用了 C++ 标准异常,而 Android NDK 编译器默认不支持 C++ 异常控制导致。
但是,从Android NDK r5 版本开始,NDK 就开始支持 C++ 异常控制了,我的版本是 r9d ,为什么还会出现这个错误呢?
原来,NDK 编译器的 C++ 异常控制特性支持默认是关闭的。要打开它,可以这样做:
编辑 Android.mk 文件,加入下面的代码:
LOCAL_CPP_FEATURES += exceptions
或者:
LOCAL_CPPFLAGS += -fexceptions
这样可以对当前项目开启 C++ 异常控制编译支持。
如果想偷懒,也可以编辑 Application.mk 文件,加入下面的代码:
APP_CPPFLAGS += -fexceptions
这样,所有模块的 C++ 异常控制编译支持都会被打开。
上面的两个 mk 文件位于 proj.android/jni 文件夹中。
转自:https://blog.zengrong.net/post/2168.html
cannot use 'throw' with exceptions disabled(转)的更多相关文章
- Type cannot use 'try' with exceptions disabled
cannot use ‘throw’ with exceptions disabled 在为 DragonBonesCPP/refactoring 的 cocos2d-x-3.2 demo 增加 An ...
- ios cannot use "@throw" with objective-c exceptions disabled 问题解决方案
http://blog.csdn.net/huayu_huayu/article/details/51781182 我不转载 我跳转 哈哈哈哈哈哈 其实也就是 解决办法:修改target -&g ...
- 【OpenCV for Android】Android Studio JNI和NDK配置及采坑记录
在配置好Android studio的OpenCV环境后,我们就可以通过Java代码调用OpenCV的API了,但是在通常情况下,用Java代码编写图像处理算法的运行效率是没有C++代码高的,在应用层 ...
- C++的异常处理之一:throw是个一无是处的东西
看这篇文章学习C++异常处理的基础知识.看完后,还不过瘾,为什么大家在C++代码中都不用Exception?为什么C++11会引入一些变化? 为什么C++ exception handling需要un ...
- Checked Exceptions
记得当年在程序员杂志上看出这次访谈,10多年过去了, 这件事儿最近被重提了, 原因是 Kotlin. 1.对Checked Exceptions特性持保留态度 (译者注:在写一段程序时,如果没有用tr ...
- Thinking in Java,Fourth Edition(Java 编程思想,第四版)学习笔记(十二)之Error Handling with Exceptions
The ideal time to catch an error is at compile time, before you even try to run the program. However ...
- jQ1.5源码注释以及解读RE
jQ作为javascript的库( ▼-▼ ), 尽善尽美, 代码优美, 值得学习. 这一周平常上班没啥事也看jQ1.5的代码, 今天周六差不多看完了(Sizzle部分还没看), 重新看了一下, ...
- jQuery1.4源码解读
来吧, 慢慢折腾吧 总结一下: jq1.4挺简单的, 正则写的不多, 看的都懂, 多写一些 三目写法到底要不要 特殊的地方的注释一定要有 /*! * jQuery JavaScript Library ...
- 立即执行函数(IIFE)的理解与运用
作为JavaScript的常用语法,立即执行函数IIFE(Immediately-Invoked Function Expression)是值得我们认真去学习探究的. 一.创建函数的两种方式 我们先从 ...
随机推荐
- Get started with IDA and disassembly SH7058
http://www.romraider.com/forum/viewtopic.php?f=25&t=6303 All of the 16-bit guidance in the follo ...
- jrebel使用
背景与愿景:开发环境下,tomcat对热布署的支持还不够全面,致使开发人员浪费大量时间在重起服务上.为了提高开发效率,决定引入Jrebel,它对热布署的支持相对比较全面.虽然Jrebel官方号称使用它 ...
- 中国LINUX内核开发大会 ppt演讲资料 与 会议视频
http://www.ckernel.org/ http://pan.baidu.com/share/home?uk=2086779999&view=share#category/type=0
- Spring DAO vs Spring ORM vs Spring JDBC
Pat 的疑惑 最近关注于 Spring 提供的数据访问技术,对于 Spring 相关的这几个项目有何不同我不是太明白: Spring-DAO (http://docs.spring.io/sprin ...
- x-superobject
x-superobject GITHUB: https://github.com/onryldz/x-superobject **Delphi Cross Platform Rapid JSON**- ...
- andriod 错误:Only the original thread that created a view hierarchy can touch its views——Handler的使用
package com.example.yanlei.myapplication; import android.media.MediaMetadataRetriever; import androi ...
- DTree的改进与使用经验
1.dtree.js源码 function Node(id, pid, name, url, title, target, icon, iconOpen, open) { this.id = id; ...
- MyBatis+Spring SQL效率测试报告
1. 数据库结构 2. insert 测试 insert 的测试包括 1) 批量拼接values()插入 2) 有事务for循环插入 3) 无事务for循环插入 测试 SQL: <!-- 普通 ...
- 【BZOJ】【1089】【SCOI2003】严格n元树
高精度/递推 Orz Hzwer…… 然而我想多了…… 理解以后感觉黄学长的递推好精妙啊 顺便学到了一份高精度的板子= =233 引用下题解: f[i]=f[i-1]^n+1 ans=f[d]-f[d ...
- Mysql 监控 支持 mysql 多实例自动发现以及主从监控
在[/usr/local/zabbix327/bin] 目录下新建python文件,并增加执行权限,如下: #!/usr/bin/env /usr/bin/python # _*_ coding:ut ...