I can\'t figure out how to use shared pointers within my Android project. I\'m using the latest Eclipse ADT on Mac OS X with the Android NDK r8d.
Here is what is in
Be sure that the standard library include path (like /android-ndk-r8d/sources/cxx-stl/gnu-libstdc++/4.7/include
) is in the target settings.
To get the IDE to recognize C++11 classes in the GNU standard library, add __GXX_EXPERIMENTAL_CXX0X__
as a predefined macro to the indexer. (The name is a bit of anachronism since C++11 is standardized and the support is no longer experimental, but as yet that's what it's called.) Also, be sure the indexer is set to reflect the correct build target.
these settings did it for me:
Application.mk:
NDK_TOOLCHAIN_VERSION=4.7
APP_STL := gnustl_static
Android.mk:
LOCAL_CFLAGS :=-D__GXX_EXPERIMENTAL_CXX0X__ <--important
LOCAL_CPPFLAGS := -std=c++11
Eclipse Settings: C/C++ General\Path and Symbols should contain:
C:\android\ndk\sources\cxx-stl\gnu-libstdc++\4.7\include
C:\android\ndk\sources\cxx-stl\gnu-libstdc++\4.7\libs\armeabi\include