std::to_string is not memember of std android

cmake 构建就没这个问题

c++库的问题

AAtransMBP:android lijin$ /Users/lijin/Library/Android/sdk/ndk-bundle/ndk-build 
Android NDK: WARNING: APP_STL gnustl_static is deprecated and will be removed in the next release. Please switch to either c++_static or c++_shared. See https://developer.android.com/ndk/guides/cpp-support.html for more information.    

双重保险

  • Application.mk 里
APP_STL := c++_static
APP_CPPFLAGS := -frtti -fexceptions -std=c++11
APP_ABI := armeabi-v7a
APP_PLATFORM := android-21
  • gralde 里
        ndk {
            moduleName "ccsdk"
            abiFilter "armeabi-v7a"
            stl "c++_static"
            ldLibs "log"
        }

如果怕有风险

#include <string>
#include <sstream>

#if defined(__ANDROID__)
#define TO_STRING to_stringAndroid

template <typename T>
inline std::string to_stringAndroid(T value)
{
    std::ostringstream os ;
    os << value ;
    return os.str() ;
}


#else

#define TO_STRING std::to_string

#endif

猜你喜欢

转载自blog.csdn.net/commshare/article/details/81739593
std
今日推荐