Using #include<vector> with Android

1,722 views
Skip to first unread message

jpujol95

unread,
Jul 8, 2009, 11:19:44 AM7/8/09
to android-ndk
Hello.

Does anyone know how to build a C++ code containing the "vector" data
structure?

-------------------------
#include <vector>
-------------------------

When compiling, I get the error:
"vector: No such file or directory".

Indeed, the file vector doesn't seem to exist in the NDK folder. I
have it in a Visual Studio folder but I can't figure out how to
integrate it within Android as it generates a flood of compiling
errors because of dependencies on other files.

Does a similar data structure exist in Android?

Regards,

Jonathan



D. Kevin McGrath

unread,
Jul 8, 2009, 1:28:13 PM7/8/09
to andro...@googlegroups.com
You can't. STL structures are unsupported. Which is why we lack even
a <string> header...

jpujol95

unread,
Jul 9, 2009, 9:42:38 AM7/9/09
to android-ndk
Thank you for your response.

Do you have an idea of what kind of data structure I could use
instead? I only need to: add, count, and remove elements from a list
whom size is unknown.

Regards,

Jonathan


On 8 juil, 19:28, "D. Kevin McGrath" <d.kevin.mcgr...@gmail.com>
wrote:
> You can't.  STL structures are unsupported.  Which is why we lack even  
> a <string> header...
>
> On 08 Jul 2009, at 11:19 AM, jpujol95 wrote:
>
>
>
> > Hello.
>
> > Does anyone know how to build a C++ code containing the "vector" data
> > structure?
>
> > -------------------------
> > #include <vector>
> > -------------------------
>
> > When compiling, I get the error:
> > "vector: No such file or directory".
>
> > Indeed, the filevectordoesn't seem to exist in the NDK folder. I

Dmitry.Skiba

unread,
Jul 10, 2009, 5:08:49 AM7/10/09
to android-ndk
You can use stlport from gears that I adapted to NDK:
http://groups.google.com/group/android-ndk/t/80f76510d7bf7df8
Note that you need to modify your NDK in order this to work.


Dmitry

Elvis Dowson

unread,
Jul 10, 2009, 11:58:46 AM7/10/09
to andro...@googlegroups.com
Hi,
     One thing I must warn is that libstdc++ implementation in android is extermely poor, just 4 to 5 basic constructs, like new, etc. I tried porting uSTL, got that done, and then realized that it lacked a streambuf implementation. So please be very careful on what libstdc++ features your particular implementation might require. I've tried uSTL 1.0, uSTL 1.2 and uSTL 2.0 (from cvs). 

Best regards,

Elvis
Reply all
Reply to author
Forward
0 new messages