Problems to compile opencv library with support c++11 in Android NDK

asked 2015-08-10 17:01:58 -0500

down vote favorite all

I have Problems to compile opencv library with support c++11 in Android NDK, I have a project configure with opencv 2.4.11 and i need to use some classes that support c++11, but when I enable c++11 in the project and compile with Android NDK, the project doesn't work.

I did the next inside jni folder:

enable c++11 in the next files:

Android.mk file

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
OPENCV_CAMERA_MODULES:=off
OPENCV_INSTALL_MODULES:=off
OPENCV_LIB_TYPE:=STATIC
include /OpenCV-android-sdk/sdk/native/jni/OpenCV.mk
LOCAL_SRC_FILES  := DetectionBasedTracker_jni.cpp
LOCAL_C_INCLUDES += $(LOCAL_PATH)
LOCAL_LDLIBS     += -llog -ldl
LOCAL_MODULE     := detection_based_tracker
include $(BUILD_STATIC_LIBRARY)

Application.mk file

//change gnustl_static to c++_static
APP_STL := c++_static
//add -std=c++11 to enable support c++11
APP_CPPFLAGS += -std=c++11 -frtti -fexceptions
APP_ABI :=  armeabi-v7a
APP_PLATFORM := android-13
NDK_TOOLCHAIN_VERSION := 4.8

When I compile with NDK command ndk-build, I have the next error:

OpenCV-android- sdk/sdk/native/jni/include/opencv2/core/operations.hpp:77:29: fatal error: atomicity.h: No such file or directory #include <atomicity.h>

Would you help me with issue, thank you.

edit retag flag offensive close merge delete

Comments

Are you sure you use 2.4.11? Line 77 differs from yours

Doesn't gnustl or stlport support C++11? Have you tried to build with clang or GCC 4.9? Probably some change is needed in operations.hpp to support libc++.

mshabunin gravatar imagemshabunin ( 2015-08-12 04:35:05 -0500 )edit