Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse indexer errors when using STL with Android NDK

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 ?

like image 495
user1002546 Avatar asked Feb 21 '12 10:02

user1002546


1 Answers

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
like image 189
Violet Giraffe Avatar answered Sep 24 '22 08:09

Violet Giraffe