在C++11标准库中,string.h已经添加了to_string方法,方便从其他类型(如整形)快速转换成字面值。但是在NDK编译过程中发现如下问题:
error: 'to_string' was not declared in this scope
使用std::to_string()之后继续报错
error: 'to_string' is not a member of 'std'
这时,查看Application.mk中,模板库选择,发现
APP_STL := gnustl_static
改成
APP_STL := c++_static
编译通过!