如何使用Androidndk

时间:2015-05-11 07:39:15

标签: android android-ndk android.mk

我正在尝试为Android构建CLM。我创建Android.mk文件,同时构建其抛出异常 我的android.mk文件看起来像这样

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

OPENCV_CAMERA_MODULES:=on
OPENCV_INSTALL_MODULES:=on
OPENCV_LIB_TYPE:=SHARED

include /Documents/adt-bundle-mac-x86_64-20140702/OpenCV-3.0.0-android-sdk/sdk/native/jni/OpenCV.mk

LOCAL_MODULE    := CLM

LOCAL_SRC_FILES := CCNF_patch_expert.cpp CLM_utils.cpp CLM.cpp CLMTracker.cpp DetectionValidator.cpp Patch_experts.cpp PAW.cpp PDM.cpp SVR_patch_expert.cpp

LOCAL_C_INCLUDES := /Documents/Mk/C-Projects/CLM/include\
                    /Documents/adt-bundle-mac-x86_64-20140702/OpenCV-3.0.0-android-sdk/sdk/native/jni/include\
                    /Documents/adt-bundle-mac-x86_64-20140702/OpenCV-3.0.0-android-sdk/sdk/native/jni/include/opencv\
                    /Documents/Mk/C-Projects/CLM/eigen3



LOCAL_LDLIBS     += -llog -ldl

include $(BUILD_SHARED_LIBRARY) 

构建此mk文件文件我有例外

  

包含来自的文件   /Documents/Mk/C-Projects/CLM/include/CLM_utils.h:9:0,                    来自jni / CCNF_patch_expert.cpp:3:/Documents/Mk/C-Projects/CLM/include/CLM.h:170:15:错误:预期','   或'&&'之前的'...'令牌CLM(const CLM&& other)                  ^ /Documents/Mk/C-Projects/CLM/include/CLM.h:170:23:错误:构造函数无效;你可能意味着'CLMTracker :: CLM(const   CLMTracker :: CLM&)'CLM(const CLM&& other)                          ^ /Users/hubmaci7/Documents/Mourish/SWIG/C-Projects/CLM/include/CLM.h:192:28:   错误:在'&&'之前预期','或'...'令牌CLM&运算符=   (const CLM&& other)                               ^ /Documents/Mk/C-Projects/CLM/include/CLM.h:在复制构造函数中   'CLMTracker :: CLM :: CLM(const CLMTracker :: CLM&)':   /Users/hubmaci7/Documents/Mourish/SWIG/C-Projects/CLM/include/CLM.h:121:32:   错误:'>>'应该是'> >”在嵌套模板参数列表中   for(std :: map> :: const_iterator it =   other.kde_resp_precalc.begin(); it!= other.kde_resp_precalc.end();   它++)                                   ^ /Documents/Mourish/SWIG/C-Projects/CLM/include/CLM.h:124:60:错误:   '>>'应该是'> >”在嵌套模板参数列表中       this-> kde_resp_precalc.insert(std :: pair>(it-> first,it-> second.clone()));                                                               ^ /Documents/Mk/C-Projects/CLM/include/CLM.h:在成员函数中   “CLMTracker :: CLM和放大器; CLMTracker :: CLM :: operator =(const CLMTracker :: CLM&)':   /Documents/Mk/C-Projects/CLM/include/CLM.h:158:33:错误:'>>'应该   是'> >”在嵌套模板参数列表中       for(std :: map> :: const_iterator it = other.kde_resp_precalc.begin(); it!= other.kde_resp_precalc.end();   它++)

请帮我找到正确的解决方案来构建clm for android

1 个答案:

答案 0 :(得分:0)

我使用Androidndk在Android中获得了构建CLM的答案。在Application.mk文件中,我确实错了,我没有添加CPP_FLAGS -std = c ++ 11。

我的Application.mk文件看起来像这样

APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions -std=c++11

APP_ABI := armeabi-v7a
APP_PLATFORM := android-9

最后我为CLM构建了这一代