Jameo
Jameo

Reputation: 4617

Android CDT setup std cannot be resolved

I have been programing with the CDT for a while, and it has worked fine. In general everything works with it, for example I can import opencv fine by typing

using namespace cv;

However, right now there are two imports that don't work, that I need.

#include <vector>
using namespace std;

These both are underlined, the std causing a compile error(the other just a warning). When I set it up, this guide told me that the following includes will take those errors away:

# for NDK r8b and later:
${NDKROOT}/platforms/android-9/arch-arm/usr/include
${NDKROOT}/sources/cxx-stl/gnu-libstdc++/4.6/include
${NDKROOT}/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include
${ProjDirPath}/../../sdk/native/jni/include

However that only helped for the opencv stuff. I am using NDK v r8d(most recent to my knowledge). Other than these includes, I can get it to compile and build. I would appreciate any pointer in the right direction!

Upvotes: 1

Views: 581

Answers (1)

Jameo
Jameo

Reputation: 4617

I'm not sure why this isnt anywhere in the OpenCV Docs, but heres how you get it to compile:

In addition to the includes above, you need to also include two more(if there not already there). You need to find where your c++ files are. On a mac, they will be at /usr/include. So add the following two imports under Project Properties->C/C++ General-> Paths and Symbols->Includes Tab

/usr/include/c++/<your version of c++>
/usr/include

In my case the above was like this:

/usr/include/c++/4.2.1
/usr/include

Upvotes: 2

Related Questions