Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fixing Eclipse errors when using Android NDK and std::vector

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

like image 914
nkassis Avatar asked Oct 05 '11 20:10

nkassis


1 Answers

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.

like image 132
zooz Avatar answered Oct 13 '22 00:10

zooz