Cannot find <iostream>

2,462 views
Skip to first unread message

Oceanblue

unread,
Apr 29, 2011, 12:44:01 PM4/29/11
to android-ndk
The following line in my code gives a compilation error:
#include <iostream>

This is the error:
error: iostream: No such file or directory

When I search for "iostream" within ndk directory, sure enough, I find
two of them:
$NDK/sources/cxx-stl/gnu-libstdc++/include
$NDK/sources/cxx-stl/stlport/stlport

and a text file with that name too.

Not sure why the compilation error is occurring. Any help would be
appreciated!

Jocelyn Houle

unread,
Apr 29, 2011, 1:13:55 PM4/29/11
to andro...@googlegroups.com


By default, the C++ standard library is very minimal.

You need to set APP_STL in your Application.mk file.

I use:

APP_STL := gnustl_static

but you could have used system, stlport_static, stlport_shared, or gnustl_static.

It's documented under $NDK/docs/CPLUSPLUS-SUPPORT.html, and it's a little hidden, because the $NDK/documentation.html index file doesn't list it.

Oceanblue

unread,
Apr 29, 2011, 2:22:04 PM4/29/11
to android-ndk
@ Jocelyn Houle: Thanks so much for your detailed answer. I looked up
those documents. good info.

It works perfectly now :-)
Reply all
Reply to author
Forward
0 new messages