I'm trying to compile some C++11 code using NDK r9b, however no matter what I try it doesn't work. Compiling without C++11 features works fine.
Here is my Application.mk:
NDK_TOOLCHAIN_VERSION := 4.8
APP_STL := gnustl_static
Here is my Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
FILE_LIST := $(wildcard $(LOCAL_PATH)/*.cpp)
LOCAL_CPPFLAGS := -std=c++11 -pthread -frtti -fexceptions
LOCAL_MODULE := RAGEAndroid
LOCAL_SRC_FILES := jni.c $(FILE_LIST:$(LOCAL_PATH)/%=%)
LOCAL_LDLIBS := -llog -lm -landroid -lGLESv3
include $(BUILD_SHARED_LIBRARY)
I have tried setting the following too without luck:
LOCAL_CFLAGS := -D__GXX_EXPERIMENTAL_CXX0X__
LOCAL_CPPFLAGS := -std=gnu++11 -pthread -frtti -fexceptions
I have ensured that Eclipse has the following paths in C++ general->Paths and Symbols
(ndk path)/sources/cxx-stl/gnu-libstdc++/4.8/include
(ndk path)/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi/include
I have one C file (jni.c) and a couple of test cpp/hpp. Everything compiles fine without any C++11 features, and including something like <thread> or <memory> doesn't cause any complaints, however when actually creating a std::thread object I get "Type 'std::thread' could not be resolved". This also happens with other features I am trying to use (std::unique_ptr, std::shared_ptr, std::move() e.t.c).
I've read many topics on getting C++11 to compile but nothing seems to work, I believe I've missed something but can't figure out what it is. Any help would be appreciated!
EDIT: If I print __cplusplus it shows 201103L, so it looks like it's using the correct version.
EDIT 2: std::atomic seems to work fine.