Unable to include iostream in android why?

Just so the answer is readily accessible here on SO, here it is:

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.

Quoted from http://groups.google.com/group/android-ndk/browse_thread/thread/983c436239d48704?pli=1


Another way is that if you don't have application.mk and android.mk file,

add this in your build.gradle

ndk{
    moduleName = your_module_name
    stl = "c++_static"
}

Tags:

C++

Android