我正在使用Qt编写一个Android应用程序,使用opencv.我设置了所有内容,以便我的应用程序无需opencv即可正常运行.但是,在我包含opencv 3.2(通过下载最新的sdk并设置库路径)之后,编译失败了数百个未定义的引用错误,所有这些都涉及到carotene_o4t
.
C:/opencv/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_core.a(arithm.cpp.o):arithm.cpp:function cv::hal::cmp8u(unsigned char const*, unsigned int, unsigned char const*, unsigned int, unsigned char*, unsigned int, int, int, void*): error: undefined reference to 'carotene_o4t::isSupportedConfiguration()' C:/opencv/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_core.a(arithm.cpp.o):arithm.cpp:function cv::hal::cmp8u(unsigned char const*, unsigned int, unsigned char const*, unsigned int, unsigned char*, unsigned int, int, int, void*): error: undefined reference to 'carotene_o4t::cmpGE(carotene_o4t::Size2D const&, unsigned char const*, int, unsigned char const*, int, unsigned char*, int)' C:/opencv/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_core.a(arithm.cpp.o):arithm.cpp:function cv::hal::cmp8u(unsigned char const*, unsigned int, unsigned char const*, unsigned int, unsigned char*, unsigned int, int, int, void*): error: undefined reference to 'carotene_o4t::cmpEQ(carotene_o4t::Size2D const&, unsigned char const*, int, unsigned char const*, int, unsigned char*, int)'
... 等等.
什么是carotene_o4t,我该如何解决这个问题?搜索这些消息后,Google将返回零结果.
项目文件如下所示:
INCLUDEPATH += C:/opencv/OpenCV-android-sdk/sdk/native/jni/include OPENCV3RDPARTYLIBS = C:/opencv/OpenCV-android-sdk/sdk/native/3rdparty/libs/armeabi-v7a OPENCVNATIVELIBS = C:/opencv/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a LIBS += $$OPENCV3RDPARTYLIBS/liblibtiff.a \ $$OPENCV3RDPARTYLIBS/liblibjpeg.a \ $$OPENCV3RDPARTYLIBS/liblibjasper.a \ $$OPENCV3RDPARTYLIBS/liblibpng.a \ $$OPENCV3RDPARTYLIBS/libtbb.a \ $$OPENCV3RDPARTYLIBS/libIlmImf.a LIBS += $$OPENCVNATIVELIBS/libopencv_core.a \ $$OPENCVNATIVELIBS/libopencv_flann.a \ $$OPENCVNATIVELIBS/libopencv_imgproc.a \ $$OPENCVNATIVELIBS/libopencv_highgui.a \ $$OPENCVNATIVELIBS/libopencv_features2d.a \ $$OPENCVNATIVELIBS/libopencv_calib3d.a \ $$OPENCVNATIVELIBS/libopencv_ml.a \ $$OPENCVNATIVELIBS/libopencv_objdetect.a \ $$OPENCVNATIVELIBS/libopencv_photo.a \ $$OPENCVNATIVELIBS/libopencv_stitching.a \ $$OPENCVNATIVELIBS/libopencv_superres.a \ $$OPENCVNATIVELIBS/libopencv_video.a \ $$OPENCVNATIVELIBS/libopencv_videostab.a \ $$OPENCVNATIVELIBS/libopencv_java3.so \ $$OPENCVNATIVELIBS/libopencv_calib3d.a \ $$OPENCVNATIVELIBS/libopencv_imgcodecs.a \ $$OPENCVNATIVELIBS/libopencv_shape.a \ $$OPENCVNATIVELIBS/libopencv_videoio.a \ SOURCES += main.cpp\ mainwindow.cpp HEADERS += mainwindow.h FORMS += mainwindow.ui contains(ANDROID_TARGET_ARCH,armeabi-v7a) { ANDROID_EXTRA_LIBS = \ $$PWD/../../../../opencv/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_java3.so }
路径本身似乎是正确的,因为如果我在代码中不包含opencv.hpp,它就会运行得很好.另一方面,项目文件中的错误路径会阻止构建它.
你需要链接libtegra_hal
.
它包含在3rdparty文件夹中: sdk/native/3rdparty/libs/armeabi/libtegra_hal.a