android – 错误:’to_string’不是’std’的成员

前端之家收集整理的这篇文章主要介绍了android – 错误:’to_string’不是’std’的成员前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
它可能是重复的,但我尝试了我在StackOverflow上找到的所有解决方案.

我正在使用OpenCV在C上创建一个库,并尝试为Android编译它.

我不能使用to_string(int)但我不能.我试图修改我的makefile太多次了.我的最后一个配置就是:

Android.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

OPENCV_CAMERA_MODULES:=off

OPENCV_INSTALL_MODULES:=on

include $(LOCAL_PATH)/jsoncpp/Android.mk

include /Users/rafaelruizmunoz/Desktop/AndroidDevelopment/OpenCV-2.4.9-android-
sdk/sdk/native/jni/OpenCV.mk

OPENCV_LIB_TYPE:=SHARED

LOCAL_C_INCLUDES += $(LOCAL_PATH)

LOCAL_C_INCLUDES += /Users/rafaelruizmunoz/opencvscan/OpenCVtry/

LOCAL_C_INCLUDES += /Users/rafaelruizmunoz/Desktop/RD/OpenCVtry/Libraries/jsoncpp-
master/include

LOCAL_PATH := jni

LOCAL_ALLOW_UNDEFINED_SYMBOLS := true

LOCAL_MODULE := libXYZ

LOCAL_MODULE_NAME := mylibXYZ

LOCAL_SRC_FILES := androidClass.cpp main.cpp utils.cpp

LOCAL_LDLIBS += -llog -ldl

LOCAL_CPPFLAGS := -std=c++11 CFLAGS=-g -Wall -Wextra -std=c++11 -Wno-write-strings
../../include/boost

LOCAL_SHARED_LIBRARIES := libJsoncpp libopencv_java

include $(BUILD_SHARED_LIBRARY)

这是我的Application.mk

APP_STL := gnustl_static

APP_CPPFLAGS := -frtti -fexceptions

APP_ABI := all

APP_MODULES := libXYZ libJsoncpp

APP_CPPFLAGS := -std=gnu++0x

APP_CPPFLAGS += -frtti

APP_CPPFLAGS += -fexceptions

APP_CPPFLAGS += -DDEBUG

APP_CPPFLAGS += -std=c++11

NDK_TOOLCHAIN_VERSION := 4.8

LOCAL_C_INCLUDES += ${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/4.8/include

APP_USE_CPP0X := true

提前致谢.

解决方法

Android NDK 9附带 llvm-libc++,完全支持cpp11功能.要启用它,您只需在Application.mk中修改这些:
APP_CPPFLAGS := -std=c++11

APP_STL:=c++_static

要么

APP_STL:=c++_shared

猜你在找的Android相关文章