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: file

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
include /OpenCV-android-sdk/sdk/native/jni/
LOCAL_SRC_FILES  := DetectionBasedTracker_jni.cpp
LOCAL_LDLIBS     += -llog -ldl
LOCAL_MODULE     := detection_based_tracker
include $(BUILD_STATIC_LIBRARY) 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

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


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