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...

Community
  • 1
  • 1
Danicco
  • 1,573
  • 2
  • 23
  • 49
  • 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. – Seva Alekseyev Mar 06 '14 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 06 '14 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. – Seva Alekseyev Mar 06 '14 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 06 '14 at 16:12
  • Build errors appear in the Console view and in the Problems view. Did you check those? – Seva Alekseyev Mar 06 '14 at 16:14
  • @SevaAlekseyev Yes, the Console shows that the C++ lib built successfully, but the Problems view are still there (and somehow increasing). – Danicco Mar 06 '14 at 16:16
  • So what's under Problems (Errors, not Warnings)? – Seva Alekseyev Mar 06 '14 at 16:21
  • @SevaAlekseyev Edited the question with a SS of the Problems and Console tabs, and thanks for the orientation so far! I would be still trying to include the VS headers in Eclipse if you haven't said so... – Danicco Mar 06 '14 at 16:24
  • possible duplicate of [Fixing Eclipse errors when using Android NDK and std::vector](http://stackoverflow.com/questions/7667017/fixing-eclipse-errors-when-using-android-ndk-and-stdvector) – Danicco Mar 06 '14 at 16:47

1 Answers1

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.

Seva Alekseyev
  • 59,826
  • 25
  • 160
  • 281
  • 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 ` and `using namespace std` lines doesn't mark as errors though. – Danicco Mar 06 '14 at 16:29
  • Try to clean and rebuild. Sometimes stale errors persist in the Problems window. – Seva Alekseyev Mar 06 '14 at 17:11