android+引用非+android+工程,[非原创]编译android C++工程找不到exception handle的解决办法...

C++工程有时候会进行异常处理,

所以在编译的过程中,可能会遇到这种提示:

exception handling disabled, use

-fexceptions to enable

这是编译选项没有支持错误处理导致的。

这种情况下要做两处修改:

1) Android.mk里面增加:

LOCAL_CPPFLAGS += -fexceptions -lstdc++

2) Application.mk里面:

APP_STL :=gnustl_static

而不是stlport_static

对于原因,网上有大神提供了很好的解释:

参见:

http://stackoverflow.com/questions/9226513/linker-errors-in-android-ndk-undefined-reference-to-cxa-end-cleanup

After reading

android-ndk/docs/CPLUSPLUS-SUPPORT.html I found that there a couple

more libraries that I can link to:

C++  C++  Standard

Exceptions

RTTI  Library

system  no  no  no

gabi++  no  yes  no

stlport  no  yes  yes

gnustl  yes  yes  yes

I'm not sure if using the gnustl library is

going to help, but it certainly does stop the linker errors and

moves the build problems onto a different set of

errors.

可见gnustl

支持的特性是最多的,所以以后再写application.mk的时候 尽量用 gnustl

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值