Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 273
Hellhound Avatar asked Mar 19 '13 12:03

Hellhound


1 Answers

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).

like image 76
reqzix Avatar answered Oct 18 '22 14:10

reqzix