I cannot call stdlib functions like to_string, stoi, etc

I can’t call stdlib functions like stoi, or to_string.
I’m using NDK r9d, Cocox2d-x 3.4beta0 and confirmed Application.mk has this line:

APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char

So, I think I can call c++11 functions in my project, but it does not recognize symbol, or allow to call stoi(), or to_string.
Do you have any idea?

I think you need NDK r10c+, IIRC.

as far as I know, r9d also supports c++11. Still, should I update NDK?

NDK r9d do support C++11, but Bionic doesn’t have a full support of C++11.

In particular, there is a comment in CCFontAtlasCache.cpp that state:

// std::to_string is not supported on android, using std::stringstream instead.

In this particular case, I’m sure it’s outdated, since I use std::to_string in several instances on Android using NDK r9d. But there are definitely some functions that are not available, I runned into this problem several times.

In my Application.mk, I have the following lines, which could be related:

APP_STL := c++_static
NDK_TOOLCHAIN_VERSION=clang
1 Like