Skip to main content

Using the STL with Android NDK C++



I am trying to use the STL in an Android NDK C++ File. I try to use map, vector and various other stl classes and I cannot compile it because it doesn't find the files.





My classes header starts with:







#pragma once

#include <map>

#include <iostream>

#include <stdexcept>

#include <vector>

#include <set>

#include <list>

#include <algorithm>







and I get following error messages:







2> In file included from jni/../../Classes/Assist/Test.cpp:1:

2> jni/../../Classes/Assist/Test.h:2:15: error: map: No such file or directory

2> jni/../../Classes/Assist/Test.h:3:20: error: iostream: No such file or directory

2> jni/../../Classes/Assist/Test.h:4:21: error: stdexcept: No such file or directory

2> jni/../../Classes/Assist/Test.h:5:18: error: vector: No such file or directory

2> jni/../../Classes/Assist/Test.h:6:15: error: set: No such file or directory

2> jni/../../Classes/Assist/Test.h:7:16: error: list: No such file or directory

2> jni/../../Classes/Assist/Test.h:8:21: error: algorithm: No such file or directory

2> In file included from jni/../../Classes/Assist/Test.cpp:1:







I read various posts and tried "APP_STL := stlport_static" and "APP_STL := gnustl_static" in an application.mk file but it didn't work.





Does anyone know how I can get this to work ?


Comments

  1. It seems that the mistake was a somehow broken NDK. I reinstalled it (delete, unzip) and now it works.

    ReplyDelete

Post a Comment

Popular posts from this blog

Slow Android emulator

I have a 2.67 GHz Celeron processor, 1.21 GB of RAM on a x86 Windows XP Professional machine. My understanding is that the Android emulator should start fairly quickly on such a machine, but for me it does not. I have followed all instructions in setting up the IDE, SDKs, JDKs and such and have had some success in staring the emulator quickly but is very particulary. How can I, if possible, fix this problem?