In a android ndk project I need to use vector. After including vector and the declaration compiler says that it doesn’t know the vector class. Here is my code and the error –
To resolve this, first ensure that your project is NDK project. If not then right click on the project, select “Android Tools” > “Add native support”.
After that create a file in the jni directory named “Application.mk” (PROJECT_ROOT/jni/Application.mk) and add “APP_STL := strlport_static”
Then right click on the project and then select “Project Properties” and the add the stl inclusion path. The path is relative to your ndk installation directory. I used eclipse variable $(NDK_DIR) which I included to my eclipse before.
After that clean and build your project. Your code should be working with the stl classes now.
Leave a Reply