C++11 build errors std::shared_ptr


I'm getting build errors on std::shared_ptr for Android. 

I am using std::shared_ptr as well as C++11 iterators in some parts of the project. 

I managed to get the JUCE demo compiling for Android without problems and tested on my device. 

In my Introjucer project I have set the C++11 flag, set the toolchain to 4.8 and also tried adding to 'External libraries to link':  <my user home>/dev/SDKs/android-ndk/sources/cxx-stl/gnu-libstdc++/4.8/include

Its coming up with errors like 

jni/../../../Source/SharedObjects.h:31:5: error: 'shared_ptr' in namespace 'std' does not name a type
     std::shared_ptr<Scale> scale;

It'd be a shame to have to take out the C++11 stuff to get it working on Android. I could swap std::shared_ptr for SharedResourcePointer.


Also posted on Stack Overflow: http://stackoverflow.com/questions/27453744/building-juce-project-for-android-with-c11


Does this help? 




Yes it does thanks, still not getting it to compile though. 

Not sure if I've set the external libraries in the correct place. 

In 'External libraries to link' I have:


I've added extra ones for different platforms based on http://stackoverflow.com/questions/9375708/eclipse-indexer-errors-when-using-stl-with-android-ndk/15782177#15782177"

However not sure this is right place to add them? 

I'm getting the following warning:

[exec] Android NDK: WARNING:jni/Android.mk:juce_jni: non-system libraries in linker flags: -l/dev/audio_libraries/aubio/src -l/dev/SDKs/android-ndk/sources/cxx-stl/gnu-libstdc++/4.8/include -l/dev/SDKs/android-ndk/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi/include -l/dev/SDKs/android-ndk/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include -l/dev/SDKs/android-ndk/platforms/android-9/arch-arm/usr/include
     [exec] Android NDK:     This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
     [exec] Android NDK:     or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
     [exec] Android NDK:     current module


I also added to 'Extra compiler flags'


As recommended at http://stackoverflow.com/questions/14532057/smart-pointers-not-working-with-android-ndk-r8 (thanks Bazrush)


So I realised my error... I didnt have 

​#include <memory>

which isn't needed for OSX but obviously is needed for Android