一、编译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