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

Started by
6 comments, last by Cornstalks 11 years ago

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?

Advertisement

It is because with some versions of the NDK there is not STL included. You should download STL port for example. or micro STL, or apache STL god knows which your prefer.

also, I recommend downloading and setuping boost the fastest as you can into your project.

then you can use boost::lexical_cast for that. and cool python-like message formatters like boost::format. also cool string algorithms...

Thanks for the hint with the STL. I've also tried STLPort, but this is not an option, too many c++11 features are not supported yet.

Boost is also not an option for me, I've removed boost a few weeks ago, while the core boost features I've used until yet are now

elements of the new c++11 standard. I don't want to have boost dependencies anymore...

Meanwhile I've figured out that the visibility appears to be guarded inside "basic_string.h", quite possibly due to

"_GLIBCXX_HAVE_BROKEN_VSWPRINTF".

interesting :) yeah boost is greatly outdated by c++11, so it is super great if you have a recent compiler that supports it.

interesting smile.png yeah boost is greatly outdated by c++11, so it is super great if you have a recent compiler that supports it.

I wouldn't call it "outdated by c++11".

The standard is still very new in terms of compiler life cycles.


There's a wiki showing how much of the c++11 standard is implemented in a few major compilers. You will note that as of today NONE of the major compilers fully support the standard. GCC is close, but still not complete as of today.

The GCC compiler is a bit of an oddball because most of the features were proven in experimental branches of the compiler. The last of the major language features are still in the 4.8.1 branch. You can get it in the latest nightly builds, but 4.8.1 won't be supported mainstream until June or so. The N2670 changes won't make it in that build, so you are looking at close to the end of the year before all the major features are supported.

Have you tried using the clang compiler? I'm curious if this is compiler specific or not.

[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]

Have you tried using the clang compiler? I'm curious if this is compiler specific or not.

The missing functions are just that: missing functions.

Switching compiler won't change it. He'd need to switch standard libraries.

Most of the functions he listed are wrappers to corresponding C-language functions. Even if you couldn't wrap the functions, they would be easy enough to implement using C++-only features.

Have you tried using the clang compiler? I'm curious if this is compiler specific or not.

The missing functions are just that: missing functions.

Switching compiler won't change it. He'd need to switch standard libraries.

I wasn't sure if compilers bundled their own standard libraries (I figured they did, but that could be wrong), and switching compilers would switch standard libraries. Never mind, then.

[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]

This topic is closed to new replies.

Advertisement