Android NDK支持STL的正则表达式 undefined reference to 'std::regex_token_iterator

一、编译GNU的STL

Application.mk中设置:APP_STL := gnustl_static

编译发现链接错误:undefined reference to 'std::regex_token_iterator

 

二、网上搜出原因如下:

http://blog.chinaunix.net/uid-14735472-id-5541575.html

https://geekwentfreak-raviteja.rhcloud.com/blog/2014/08/04/c11-regex-using-g/

http://stackoverflow.com/questions/8561850/compile-stdregex-iterator-with-gcc

具体原因:

Seems like gcc 4.8.2, delivered by my distribution doesn’t support regex yet. So, we are forced to use Boost regex for now. Or use g++ 4.9.0 instead, which has regex implemented.

The GNU C++ standard library supports <regex>, but not until version 4.9.0. (The headers were present in earlier versions, but were unusable.)

就是说,4.8版本,有头文件,可以编译,但是没实现,链接失败。

 

三、解决方法,改编译命令行,手动设定版本:

${NDKROOT}/ndk-build.cmd  NDK_TOOLCHAIN_VERSION=4.9

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值