Android NDK Eclipse CDT不允许我使用字符串的substr方法

时间:2013-08-04 06:46:27

标签: android c++ android-ndk substring eclipse-cdt

即使像这样的简单代码也会出现错误

string test= "hello";
string part = test.substr(2, 3);

无效参数候选者是: stlpmtx_std :: basic_string,stlpmtx_std :: allocator> substr(?,?)

即使施放到size_t也没有帮助     string part = test.substr((size_t)2,(size_t)3);

但是在Linux上使用gcc 4.6将它作为控制台应用程序运行时,这两段代码都可以运行。 但是当使用Androind NDK时它会给我错误。

如果我在编辑器中关闭文件并关闭Eclipse,然后打开Eclipse并构建它编译的项目。但如果我打开文件就会引发错误。

我在Application.mk make文件中使用APP_STL:= stlport_static

是的我确实包含了< string>

编辑:我只看了.so文件的时代,它似乎正在编译,即使Eclipse显示错误。

1 个答案:

答案 0 :(得分:1)

我找到了我需要在项目属性的Paths and Symbols部分中使用stlport system include文件夹的解决方案 - > C / C ++一般

path_To_NDK/sources/cxx-stl/system/include

我只有

 path_To_NDK/sources/cxx-stl/stlport/stlport