Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to turn on the "C++0X" experimental standard when compiling .cpp files in Android-ndk (r7)?

When examining the "android-ndk-linux_x86/sources/cxx-stl/gnu-libstdc++/include/memory" header file, I find that this header includes other STL header files according to the

__GXX_EXPERIMENTAL_CXX0X__

flag. I think this flag relates to the "C++0X" standard and this standard may be yet experimental in Android-ndk r7. However, I want to turn on this C++ standard in my project. (I am not sure whether this "C++0X" standard has been turned on by default)

I want to know that how should I tell Android-ndk to set this flag when I compile the .cpp files in the "project/jni" directory of an Android project. Or how could I turn on the experimental "C++0X" standard in my application.

Do I need to specify the flag using, e.g. LOCAL_CPPFLAGS and/or APP_CPPFLAGS, in the "Android.mk"/"Application.mk" file. (I am using "APP_STL := gnustl_static" in my "Application.mk")

Thanks for any suggestion.

Lawrence Tsang

like image 776
user1129812 Avatar asked Jan 16 '12 04:01

user1129812


1 Answers

C++03 is not an experimental standard; it is the default.

C++0X, however, is an experimental standard. Its official name has now been set as C++11, but the implementation is incomplete in GCC (and everywhere else). You can enable it by passing --std=c++0x to GCC. Remember to check the feature status page before complaining that something is broken.

like image 136
bdonlan Avatar answered Oct 23 '22 09:10

bdonlan