2017-12-20 14 views
0

일부 캡처 및 이미지 효과에 opencv를 사용하는 NDK를 사용하는 Android 프로젝트에서 작업하고 있습니다. 물건.Android Studio NDK 링커 오류 'cv :: _ OutputArray :: _ OutputArray (cv :: Mat &)'에 대한 정의되지 않은 참조

../sdk/native/jni/include/opencv2/core/mat.hpp:335: error: undefined reference to 'cv::_OutputArray::_OutputArray(cv::Mat&)' 
jni/scan.cpp:33: error: undefined reference to 'cv::_InputArray::_InputArray(cv::Mat const&)' 
jni/scan.cpp:33: error: undefined reference to 'cv::_OutputArray::_OutputArray(cv::Mat&)' 
jni/scan.cpp:65: error: undefined reference to 'cv::_InputArray::_InputArray(cv::Mat const&)' 
jni/scan.cpp:65: error: undefined reference to 'cv::_InputArray::_InputArray(cv::Mat const&)' 
jni/scan.cpp:72: error: undefined reference to 'cv::_InputArray::_InputArray(cv::Mat const&)' 
jni/scan.cpp:48: error: undefined reference to 'cv::_OutputArray::_OutputArray(cv::Mat&)' 
jni/scan.cpp:51: error: undefined reference to 'cv::_OutputArray::_OutputArray(cv::Mat&)' 
jni/scan.cpp:58: error: undefined reference to 'cv::findContours(cv::_OutputArray const&, cv::_OutputArray const&, int, int, cv::Point_<int>)' 
..sdk/native/jni/include/opencv2/core/mat.hpp:276: error: undefined reference to 'vtable for cv::_OutputArray' 
..Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function 
..sdk/native/jni/include/opencv2/core/mat.hpp:276: error: undefined reference to 'vtable for cv::_OutputArray' 
..Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function 
jni/scan.cpp:162: error: undefined reference to 'cv::findContours(cv::_OutputArray const&, cv::_OutputArray const&, int, int, cv::Point_<int>)' 
..sdk/native/jni/include/opencv2/core/mat.hpp:276: error: undefined reference to 'vtable for cv::_OutputArray' 
/Users/mtsindia/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function 
..sdk/native/jni/include/opencv2/core/mat.hpp:276: error: undefined reference to 'vtable for cv::_OutputArray' 
..Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function 
jni/scan.cpp:261: error: undefined reference to 'vtable for cv::_InputArray' 
..Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function 
jni/scan.cpp:296: error: undefined reference to 'cv::Exception::Exception(int, std::string const&, std::string const&, std::string const&, int)' 
jni/scan.cpp:297: error: undefined reference to 'cv::Exception::Exception(int, std::string const&, std::string const&, std::string const&, int)' 
jni/scan.cpp:298: error: undefined reference to 'cv::Exception::Exception(int, std::string const&, std::string const&, std::string const&, int)' 
jni/scan.cpp:299: error: undefined reference to 'cv::Exception::Exception(int, std::string const&, std::string const&, std::string const&, int)' 
:

LOCAL_PATH := $(call my-dir) 

include $(CLEAR_VARS) 

include path/to/OpenCV.mk 

LOCAL_MODULE := Scanner 

LOCAL_SRC_FILES := scan.cpp 

LOCAL_LDLIBS += -lz -lm -llog -landroid -ldl -lstdc++ 

LOCAL_LDFLAGS += -ljnigraphics -fexceptions -std=c++11 -L$(LOCAL_PATH)/sdk/native/jni/libs/armeabi-v7a -L$(LOCAL_PATH)/sdk/native/jni/3rdparty/libs/armeabi-v7a -I$(LOCAL_PATH)/sdk/native/jni/include -I$(LOCAL_PATH)/sdk/native/jni/include/opencv2/core -I$(LOCAL_PATH)/sdk/native/jni/include/opencv2/calib3d -I$(LOCAL_PATH)/sdk/native/jni/include/opencv2/contrib -I$(LOCAL_PATH)/sdk/native/jni/include/opencv2/features2d -I$(LOCAL_PATH)/sdk/native/jni/include/opencv2/flann -I$(LOCAL_PATH)/sdk/native/jni/include/opencv2/highgui -I$(LOCAL_PATH)/sdk/native/jni/include/opencv2/imgproc -I$(LOCAL_PATH)/sdk/native/jni/include/opencv2/legacy -I$(LOCAL_PATH)/sdk/native/jni/include/opencv2/ml -I$(LOCAL_PATH)/sdk/native/jni/include/opencv2/objdetect -I$(LOCAL_PATH)/sdk/native/jni/include/opencv2/ocl -I$(LOCAL_PATH)/sdk/native/jni/include/opencv2/photo -I$(LOCAL_PATH)/sdk/native/jni/include/opencv2/stitching -I$(LOCAL_PATH)/sdk/native/jni/include/opencv2/superres -I$(LOCAL_PATH)/sdk/native/jni/include/opencv2/ts -I$(LOCAL_PATH)/sdk/native/jni/include/opencv2/video -I$(LOCAL_PATH)/sdk/native/jni/include/opencv2/videostab -I$(LOCAL_PATH)/sdk/native/jni/include/opencv2 

LOCAL_STATIC_LIBRARIES := opencv_shape opencv_stitching opencv_objdetect opencv_superres opencv_videostab opencv_calib3d opencv_features2d opencv_highgui opencv_videoio opencv_imgcodecs opencv_video opencv_photo opencv_ml opencv_flann opencv_imgproc opencv_core opencv_ts IlmImf libjasper libjpeg libpng libtiff libwebp tbb 

include $(BUILD_SHARED_LIBRARY) 

내가 모든 OpenCV의 라이브러리를 연결하고 올바른 경로를 지정하고있어 비록 나는 다음과 같은 링커 오류를 받고 있어요 (경로를 chaning하여 확인) : 여기처럼 내 Android.mk이 보는 방법

이것은 link이며 스캐너 앱 데모를 다운로드하고 scan.cpp 파일을 수정하고 라이브러리를 다시 작성하려고합니다. Android Studio에서 외부 도구로 ndk-build를 만들었으므로 ndk 경로도 확인했습니다. 내가 여기서 무엇을 놓치고 있니? 어떤 도움을 주시면 감사하겠습니다.

+1

Methinks'-lstdC++'는 사용하지 않아야합니다. –

+1

'LOCAL_STATIC_LIBRARIES + ='** ** : ** ** 대신 **'+'** –

+0

@AlexCohn Thanks. 둘 다 시도했지만 여전히 같은 오류가 발생합니다. –

답변

0

고쳐졌습니다. 나는 고정 된 정확한 이유를 모른다. 내가 Android.mk, Application.mk 및 OpenCV.mk에서 변경 한 모든 변경 사항을 되돌아 지금 내 Adnroid.mk은 다음과 같습니다

LOCAL_PATH := $(call my-dir) 

include $(CLEAR_VARS) 
OPENCV_INSTALL_MODULES:=on 
include $(LOCAL_PATH)/sdk/native/jni/OpenCV.mk 

LOCAL_MODULE := Scanner 
LOCAL_SRC_FILES := scan.cpp 
LOCAL_LDLIBS += -lm -llog -landroid 
LOCAL_LDFLAGS += -ljnigraphics 
include $(BUILD_SHARED_LIBRARY) 

그리고 Application.mk :

APP_STL := stlport_static 
APP_CPPFLAGS := -frtti -fexceptions 
APP_ABI := all 
APP_PLATFORM := android-14 

그쪽으로 내가 올바른 경로 또는 내 라이브러리 파일을 specyfying 놓친 것 같아요

https://pastebin.com/zuqM6tbu

(.so를하고 .A) 다른 버전이 될 수 있습니다 그리고 여기처럼 내 OpenCV.mk 보이는 방법 n 헤더 파일이 포함됩니다. 누군가 다른 아이디어가 있다면, 의견을 게시하십시오.

+1

좋습니다. OpenCV는'APP_STL = gnustl_static'을 기대합니다. 사실, 대부분의 경우 stlport보다 더 나은 선택입니다. –