我試圖在Qt中使用Android中的OpenCV,但是我無法在Qt中成功鏈接它,我在side libraries(如libjpeg,libtegra_hal等)上收到了一些未定義的引用錯誤。我用this SO answer作爲參考指南。無法鏈接Qt中的OpenCV Android
這是我的.pro文件 -
INCLUDEPATH += "$$PWD/../../External-Libraries/opencv-android/sdk/native/jni/include"
android {
# 3rd party libs
LIBS += \
-L"$$PWD/../../External-Libraries/opencv-android/sdk/native/3rdparty/libs/armeabi-v7a"\
-llibtiff\
-llibjpeg\
-llibjasper\
-llibpng\
-llibwebp\
-lIlmImf\
-ltbb\
-ltegra_hal
# opencv libs
LIBS += -L"$$PWD/../../External-Libraries/opencv-android/sdk/native/libs/armeabi-v7a"\
-lopencv_core\
-lopencv_highgui\
-lopencv_java3\
-lopencv_calib3d\
-lopencv_imgcodecs\
-lopencv_imgproc\
-lopencv_flann\
-lopencv_features2d\
-lopencv_ml\
-lopencv_objdetect\
-lopencv_photo\
-lopencv_shape\
-lopencv_stitching\
-lopencv_superres\
-lopencv_video\
-lopencv_videoio\
-lopencv_videostab
ANDROID_PACKAGE_SOURCE_DIR=$$PWD/android
}
我使用Qt 5.8和OpenCV 3.2.0。這些錯誤都是這種格式 -
libopencv_core.a:...錯誤:未定義引用(第三方庫的一個方法)
這是一個例子 -
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()'
其中carotene
是libtegra_hal.a
的函數。有沒有辦法將opencv庫鏈接到第三方庫?
謝謝。
編輯:
我可以成功地編譯和運行OpenCV的3.1.0庫,而不是3.2.0庫。
我googled「未定義的引用'carotene_o4t :: isSupportedConfiguration」,有一些命中 - 請參閱http://stackoverflow.com/questions/41665655/what-is-carotene-o4t-and-why-does-it-引起程序使用的原因問題,它可能會給你一些指示。嘗試禁用胡蘿蔔素按照[第三評論](http://stackoverflow.com/questions/41665655/what-is-carotene-o4t-and-why-does-it-cause-issues-with-compiling-a-program使用#comment70614446_41665655)建議。 – sashoalm
謝謝,會檢查出來。問題是OpenCV 3.2.0具體 – FadedCoder