Eclipse indexer errors when using STL with Android NDK
android, android-ndk, c++, eclipse
Solution
You have to add path to STL to project settings so that Eclipse indexes it as well. Project->Properties->C/C++ General->Includes. Here's what I have added:
<path_to_NDK>/sources/cxx-stl/gnu-libstdc++/include
<path_to_NDK>/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include
<path_to_NDK>/platforms/android-9/arch-arm/usr/include
Problem
I'm using the Android NDK r7 with eclipse Indigo on Ubuntu. I set up my java project to use the C++ nature. I'm using STL on C++ side so I added ``` APP_STL := gnustl_static ``` in the Application.mk file. ndk-build succeed compiling my code and creating a shared object. However eclipse indexer complains about missing STL symbols. For example "Method 'push_back' could not be resolved" "Symbol 'vector' could not be resolved" This happens only when C++ files are open in the editor. Ultimately eclipse won't create my apk. I added path to the gnu STL headers shiped with the ndk (Properties => C/C++ General => Code Analasys => Path & symbols) : ``` android-ndk-r7/sources/cxx-stl/gnu-libstdc++/include android-ndk-r7/sources/cxx-stl/gnu-libstdc++/include/bits ``` Current workaround is to close opened C++ files to make eclipse happy. Interestingly eclipse indexer's working fine with headers found in android-ndk-r7/platforms/android-14/arch-arm/usr/include Is there something I forgot to set up in eclipse ?