Hellhound
Hellhound

Reputation: 531

std::string operations (i.e. stol, stoi) not found NDK8d

I try to set up my first android project using ndk r8d with c++11 support. Some c+11 mechanisms work fine (i.e. lambada expressions), but when i try to use one of the new string operations, the compile fails ( error: 'stol' is not a member of 'std'). Here are my project settings:

Application.mk

APP_MODULES := MyLib   

APP_CPPFLAGS := -std=gnu++0x  
APP_CPPFLAGS += -frtti
APP_CPPFLAGS += -fexceptions
APP_CPPFLAGS += -DDEBUG   

APP_ABI := armeabi-v7a
APP_PLATFORM:=android-14                      

APP_STL := gnustl_static
APP_GNUSTL_CPP_FEATURES := rtti exceptions

NDK_TOOLCHAIN_VERSION=4.7

Are those functions actually not working?

Upvotes: 9

Views: 3689

Answers (2)

Mark S.
Mark S.

Reputation: 71

Adding:

APP_STL := c++_static

to Application.mk fixed this issue for me (using gcc 4.8.4).

solution via Daniel Tavares, from this Google Groups post.

Upvotes: 0

reqzix
reqzix

Reputation: 503

Seems to be answered in another thread.

The reason why you cannot use the functions is quite deep rooted, and unfortunately currently unsolvable.

In GNU STL implementation of these function somehow relies on c99 (_GLIBCXX_USE_C99 macro), that is not used by Android

The root cause seems to be that the C99 functionality usage has been disabled in the GNU stdlibc++ on the armeabi-v7a platform due to the fact the the Bionic libc does not support complex math (the standard C library on Android is Bionic).

Upvotes: 6

Related Questions