采用Android NDK和std :: vector的修复时的错误的Eclipse错误、NDK、Android、std

2023-09-08 09:30:30 作者:残城碎梦

我使用Eclipse来开发Android应用程序也使用NDK。我向量我的应用程序,我已经做了必要的东西,通过包括让他们

APP_STL:= stlport_static

在我的Application.mk

一切工作正常它编译和运行,但是Eclipse不断给我的错误,当我使用了矢量

 的std ::矢量<&INT GT;胡说 

例如创建一个错误。如果我删除了错误,并坚持下去它编译并运行正常。

我添加$ {} NDKROOT /来源/ CXX-STL / GNU-的libstdc ++ /包括

Not a valid NDK directory,eclipse中指定Android NDK位置时出现这句提示

在在C ++一般我的项目配置 - >路径和符号 - >包含

它解决了的#include<载体> 罚款(之前我添加上述路径我有一个错误这一点),但我仍然可以使用向量误差。

我如何获得日食停止给我这个错误?

编辑:

例如错误:符号'向量'无法解析

编辑2:

我试图添加

 使用命名空间std; 

和然后利用矢量嗒嗒和使不同的错误:

  

无效的模板参数

解决方案   

我添加了$ {} NDKROOT /来源/ CXX-STL / GNU-的libstdc ++ /包括

    

在在C ++一般我的项目配置 - >路径和符号 - >包含

是的,就是这样。我试图添加相同的具有相同的结果。但是,如果添加stl_port标题

  $ {} NDKROOT /来源/ CXX-STL / STLport的/的STLport 

它会做的伎俩。当然,没有必要改变

  APP_STL:= stlport_static 

,因为它只能在日食指标。这将是有用的,直到你要使用的东西存在于GNU-的libstdc ++和不存在的STL端口。

I'm using eclipse to develop an android app that also uses the ndk. I vectors in my app and I've done the necessary stuff to get them by including

APP_STL := stlport_static

In my Application.mk

Everything is working fine it compiles and runs but Eclipse keeps giving me errors when I use the vectors

std::vector<int> blah

for example creates an error. If I delete the error and keep going it compiles and runs fine.

I've added ${NDKROOT}/sources/cxx-stl/gnu-libstdc++/include

In my project config under C++ General -> Paths and Symbols -> include

It resolves #include <vector> fine (before I added the path above I had an error for this) but I still get errors using the vectors.

How can I get eclipse to stop giving me errors for this?

EDIT:

example error: Symbol 'vector' could not be resolved

EDIT 2:

I tried to add

using namespace std;

and then using vector blah and that causes a different error:

Invalid template arguments

解决方案

I've added ${NDKROOT}/sources/cxx-stl/gnu-libstdc++/include

In my project config under C++ General -> Paths and Symbols -> include

Yes, that's it. I've tried to add the same with the same result. However, if you add stl_port headers

${NDKROOT}/sources/cxx-stl/stlport/stlport

It will do the trick. Of course it is not necessary to change

APP_STL := stlport_static

as it works only in eclipse indexes. It will be usefull until you are going to use something that exists in gnu-libstdc++ and doesn't exist stl-port.