Latest C++11 features with Android NDK Latest C++11 features with Android NDK android android

Latest C++11 features with Android NDK


(I'm addressing the NDK version r9b)To enable C++11 support for all source code of the application (and so any modules included) make the following change in the Application.mk:

# use this to select gcc instead of clangNDK_TOOLCHAIN_VERSION := 4.8# OR use this to select the latest clang version:NDK_TOOLCHAIN_VERSION := clang# then enable c++11 extentions in source codeAPP_CPPFLAGS += -std=c++11# or use APP_CPPFLAGS := -std=gnu++11

Otherwise, if you wish to have C++11 support only in your module, add this lines into your Android.mk instead of use APP_CPPFLAGS

LOCAL_CPPFLAGS += -std=c++11

Read more here:http://adec.altervista.org/blog/ndk_c11_support/


NDK revision 10 has the Clang 3.6 toolchain. Use it:

NDK_TOOLCHAIN_VERSION := clang3.6

or use the latest available Clang toolchain

NDK_TOOLCHAIN_VERSION := clang


NDK revision 8e has the Clang 3.2 compiler bundled in it. Use it and you're good to go.