[Solved] Android-ndk-r10d error: 'to_string' is not a member of 'std'

Sorry @iQD, but Now i have this error

[armeabi] Compile++ thumb: cocostudio_static <= WidgetReader.cpp
make: execvp: /DEV/android-ndk-r10d-darwin-x86_64/android-ndk-r10d/toolchains/llvm-3.5/prebuilt/darwin-x86_64/bin/clang++: Permission denied
make: *** [obj/local/armeabi/objs-debug/cocostudio_static/WidgetReader/WidgetReader.o] Error 127
make: *** Waiting for unfinished jobs....
make: Leaving directory `MyProjects/MyGame/proj.android' 

my Application.mk file :

APP_ABI := armeabi
NDK_TOOLCHAIN := arm-linux-androideabi-clang3.5
APP_STL := c++_static
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char -arch arm 
APP_LDFLAGS := -latomic


ifeq ($(NDK_DEBUG),1)
  APP_CPPFLAGS += -DCOCOS2D_DEBUG=1
  APP_OPTIM := debug
else
  APP_CPPFLAGS += -DNDEBUG
  APP_OPTIM := release
endif

Thanks alot for your help.

Make a clean build by also deleting your obj folder, and make sure there is no make/compile process left from prior builds accessing the obj folder.

it doesn’t work, all time i have this error:

[armeabi] Compile++ thumb: cocostudio_static <= WidgetReader.cpp
make: execvp: /DEV/android-ndk-r10d-darwin-x86_64/android-ndk-r10d/toolchains/llvm-3.5/prebuilt/darwin-x86_64/bin/clang++: Permission denied
make: *** [obj/local/armeabi/objs-debug/cocostudio_static/WidgetReader/WidgetReader.o] Error 127
make: *** Waiting for unfinished jobs....
make: Leaving directory `MyProjects/MyGame/proj.android'

@ricardo @slackmoehrle @zhangxm @hhyytt could you help us please ?

Is your virus scanner blocking the execution of clang++?

Did you set the executable flag on the file?

i don’t have an antivirus.

@iQD, i’m using the NDK r10D 64bits, should I compile using NDK r10c 32bits ?

You should :smile:

Then check if clang++ has the executable flag set. The error is saying, that it’s not set.

You can go for 32Bit, as this is what Google recommends.

permission denied

seems a bit odd, just to be sure, you have read/write permissions to your directory you are building in?

Thanks, i have downloaded the NDK r10d 32bits, , and it works fine now :slight_smile:

i followed this procedure( from google website ) :

1-Download the appropriate package (NDK r10d 32bits).
2-Open a terminal window.
3-Go to the directory to which you downloaded the package.
4-Run chmod a+x on the downloaded package.
5-Execute the package. For example:

ndk$ chmod a+x android-ndk-r10d-darwin-x86.bin
ndk$ ./android-ndk-r10d-darwin-x86.bin

I just ran into this issue as well. What is the fix really? to_string is not supported by Android? It always worked when compiling for iOS/Mac.

i have created a header file

#ifndef Templates_h
#define Templates_h
#include <string>
#include <sstream>
using namespace std;
namespace std
{
    template < typename T > std::string to_string( const T& n )
    {
        std::ostringstream stm ;
        stm << n ;
        return stm.str() ;
    }
}
#endif

And each time when i need to to_string, i include it.

Change your Application.mk like this

APP_ABI := armeabi
NDK_TOOLCHAIN := arm-linux-androideabi-clang3.5
NDK_TOOLCHAIN_VERSION=4.9 
APP_STL := c++_static
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char -arch arm 
APP_LDFLAGS := -latomic


ifeq ($(NDK_DEBUG),1)
  APP_CPPFLAGS += -DCOCOS2D_DEBUG=1
  APP_OPTIM := debug
else
  APP_CPPFLAGS += -DNDEBUG
  APP_OPTIM := release
endif
2 Likes

Same here. I saw a stackoverflow discussion about a compiler bug using a certain version of the compiler.
Anyway @yagoub gave a good solution :slight_smile: