It could be duplicate, but I tried all the solutions that I found on and out StackOverflow.
I'm making a library on C++ with OpenCV and trying to compile it for Android.
I can't use to_string(int)
but I'm not able. I tried to modify my makefile too many times. My last configuration is this on:
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)
and this is my 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
Thanks in advance.
I ran into this issue too. to_string is not available in gnu-libstdc++ "out of the box". I searched the sources and found that std::to_string is indeed in the lib (sources/cxx-stl/gnu-libstdc++/4.9/include/bits/basic_string.h) but opted out by
#if ((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \
&& !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF))
After adding -D_GLIBCXX_USE_C99 to the build std::to_string is opted in.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With