1

I'm using Eclipse ADT with the Android NDK and I'm getting a lot of unresolved in strings, vectors and other C++ variables.

It's a fresh install (ADT), and I have VS2012 installed already. I've followed the steps here and understood what has to be done, but I think this "find" command isn't for Windows, but for Linux.

How can I find these missing headers in Windows to include in Eclipse's C++ Symbols and Path?

EDIT: I'm getting unresolved errors in strings, vectors and other variables in the C code. The project builds fine as show in the Console tab, but I can't run it because it says my project contains errors. Screenshot:

enter image description here

EDIT 2: I've added the \android-ndk-r9c\sources\cxx-stl\gnu-libstdc++ folder instead of the \android-ndk-r9c\sources\cxx-stl\gnu-libstdc++\4.8\include in Project->Properties->C/C++ General->Paths and Symbols and at least strings are now resolved, leaving only vectors as unresolved... is this the "right" way to solve this?

I'm slowly adding the source files and compiling to check for errors and there's still plenty of other headers I'm using besides <string> and <vector>...

FIXED: From here, last answer. I added #include <stl/_vector.h>, the Problem went away. Then I removed this line and put the old #include <vector> one and now it's not marking as error anymore... sigh. Marking this as duplicate...

9
  • What makes you think Windows run-time libraries would work under Android? If it's STL's string, vector etc, those are present in NDK's own include directory. Mar 6, 2014 at 16:03
  • @SevaAlekseyev It's exactly those, and although the NDK folders are already included in the Symbol and Paths, I'm still getting this error. I've tried all 3 fixes in the post (changing the toolchain, etc) but still didn't fix the issue.
    – Danicco
    Mar 6, 2014 at 16:06
  • Compilation error or Eclipse highlighting the #include lines? The latter is benign; as long as it compiles. Did you write using namespace std;? Anyway, plugging in Visual Studio's files is not the answer. Mar 6, 2014 at 16:10
  • @SevaAlekseyev It seems to build fine (Ctrl B doesn't show any errors), but I can't click on Run, it shows the error message "Your Project has errors, fix them before running". It's not only highlighting the #include, but error-lining everything "string", "vector" and such. Edit: I'm also using namespace std and even tried std::string.
    – Danicco
    Mar 6, 2014 at 16:12
  • Build errors appear in the Console view and in the Problems view. Did you check those? Mar 6, 2014 at 16:14

1 Answer 1

0

Can't help noticing that you use string and vector without qualifying the namespace (which is std). I couldn't see the using namespace std; statement, either.

So either replace string with std::string, or insert a using... above the class definition.

2
  • The using namespace std is way up in the code, in the first 3 lines. The SS is right in the middle where the string type is marked as unresolved. The #include <string> and using namespace std lines doesn't mark as errors though.
    – Danicco
    Mar 6, 2014 at 16:29
  • Try to clean and rebuild. Sometimes stale errors persist in the Problems window. Mar 6, 2014 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.