2017-12-20 11 views
0

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)' 
:私は、次のリンカエラーを取得しています(パスをchaningことによってそれを検証する)すべてのOpenCVのライブラリをリンクし、正しいパスを指定していますが

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) 

:ここに私のAndroid.mkがどのように見えるかです

これはlinkです。ここでスキャナアプリのデモをダウンロードし、scan.cppファイルに変更を加えてライブラリを再構築しようとしています。 私はAndroidスタジオで外部ツールとしてndk-buildを作成しましたが、ndkパスも確認しました。私はここで何が欠けていますか?どんな助けもありがとう。

+1

Methinks '-lstdC++'は使用しないでください。 –

+1

'LOCAL_STATIC_LIBRARIES + =' ** **: '**の代わりに**' ** '** –

+0

@AlexCohnありがとうございます。両方を試してみましたが、私は同じエラーが発生しています。 –

答えて

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 

THA私は正しいパスか、私のライブラリファイルをspecyfying見逃していると思います

https://pastebin.com/zuqM6tbu

(.soのと.A)異なるバージョンであるかもしれない。そして、ここのように私OpenCV.mkがどのように見えるかですヘッダファイルが含まれています。誰かが他のアイデアを持っているなら、コメントを投稿してください。

+1

良いOpenCVは 'APP_STL = gnustl_static'を期待していることに注意してください。実際には、ほとんどの場合、stlportよりも良い選択です。 –

関連する問題