1

Even a simple code like this gives the error

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

Invalid arguments Candidates are: stlpmtx_std::basic_string,stlpmtx_std::allocator> substr(?, ?)

Even casting to size_t did not not help string part = test.substr((size_t)2, (size_t)3);

But both pieces of code working when running it as a console application using gcc 4.6 on Linux. But when using Androind NDK it gives me the error.

If I close the file in the editor and close Eclipse, and then open Eclipse and build the project it compiles. But if I have the file open it throws up the error.

I am using APP_STL:= stlport_static in the Application.mk make file

Yes I did include <string>

Edit: I just looked at the times of .so file, it seems to be compiling even though Eclipse is showing the errors.

4

1 回答 1

1

我找到了解决方案,我需要在项目属性的路径和符号部分中包含 stlport 系统包含文件夹 - > C/C++ General

path_To_NDK/sources/cxx-stl/system/include

我只有

 path_To_NDK/sources/cxx-stl/stlport/stlport
于 2013-08-04T09:44:42.130 回答