Build for android via cocos console


I would like to know how come “to_string()” isn’t a member of “std” ?

Because that’s a C++11 function, and by default I don’t think cocos projects use C++11 http://stackoverflow.com/questions/22774009/android-ndk-stdto-string-support

Luckily it’s very easy to switch to C++11, just change your Android.mk to add:

LOCAL_CFLAGS    := -std=c++11

No, C++11 has been in use for a while now.

Nope, didn’t solve anything.
Also judging from the callbacks I think they take advantage of C++11 as well.

The error is probably that the header file is not being included. Explicitly #include <string> and try again.

Also using backslashes in strings for file paths is a bad idea. That won’t work at all on non-Windows platforms.

Edit application.mk
Change
APP_STL := gnustl_static
To
APP_STL := c++_static

1 Like

So what should I use?
And of course was included, additionally @sayedtdm was correct apparently, thanks mate.