对 cv::aruco::getPredefinedDictionary(cv::aruco::PredefinedDictionaryType) 的未定义引用

问题描述 投票:0回答:1

我正在尝试在 Qt 中编写一个程序,从 TCP 接收图像,然后在其中找到一个 ArUco 标记。

除了 ArUco 库之外,一切正常。一旦我添加了定义字典的简单行:

cv::aruco::Dictionary ArucoDic = cv::aruco::getPredefinedDictionary(cv::aruco::DICT_4X4_50);

我收到错误:

undefined reference to cv::aruco::getPredefinedDictionary(cv::aruco::PredefinedDictionaryType)

我发现遇到此问题的其他人可以通过在 .pro 文件中添加库来解决它,但我从一开始就遵循这些教程:

完成所有这些后,我的 .pro 文件如下所示:

QT -= gui
QT += network
QT += core

CONFIG += c++17 console
CONFIG -= app_bundle

# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

SOURCES += \
        main.cpp \
        server.cpp

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

HEADERS += \
    server.h

INCLUDEPATH += D:/OpenCV/opencv/release/install/include

LIBS += -LD:/OpenCV/opencv/release/install/x64/mingw/lib -lopencv_core480
LIBS += -LD:/OpenCV/opencv/release/install/x64/mingw/lib -lopencv_highgui480
LIBS += -LD:/OpenCV/opencv/release/install/x64/mingw/lib -lopencv_imgcodecs480
LIBS += -LD:/OpenCV/opencv/release/install/x64/mingw/lib -lopencv_imgproc480
LIBS += -LD:/OpenCV/opencv/release/install/x64/mingw/lib -lopencv_features2d480
LIBS += -LD:/OpenCV/opencv/release/install/x64/mingw/lib -lopencv_calib3d480
LIBS += -LD:/OpenCV/opencv/release/install/x64/mingw/lib -lopencv_aruco480

我真的不知道问题是什么,因为opencv_aruco480之前的所有库都工作得很好。

我也知道 Qt 正在读取 ArUco 库,因为它能够预测我正在编写的函数。它只是无法编译。

c++ qt opencv qt-creator undefined-reference
1个回答
0
投票

通过添加objdetect.dll库解决了。 我还更改了 .pro 文件中引用所有库的方式。

win32: LIBS += -L$$PWD/../../OpenCV/opencv/release/install/x64/mingw/lib/-llibopencv_core480.dll win32: LIBS += -L$$PWD/../../OpenCV/opencv/release/install/x64/mingw/lib/-llibopencv_highgui480.dll win32: LIBS += -L$$PWD/../../OpenCV/opencv/release/install/x64/mingw/lib/-llibopencv_imgcodecs480.dll win32: LIBS += -L$$PWD/../../OpenCV/opencv/release/install/x64/mingw/lib/-llibopencv_imgproc480.dll win32: LIBS += -L$$PWD/../../OpenCV/opencv/release/install/x64/mingw/lib/-llibopencv_features2d480.dll win32: LIBS += -L$$PWD/../../OpenCV/opencv/release/install/x64/mingw/lib/-llibopencv_calib3d480.dll win32: LIBS += -L$$PWD/../../OpenCV/opencv/release/install/x64/mingw/lib/-llibopencv_aruco480.dll win32: LIBS += -L$$PWD/../../OpenCV/opencv/release/install/x64/mingw/lib/-llibopencv_dnn480.dll win32: LIBS += -L$$PWD/../../OpenCV/opencv/release/install/x64/mingw/lib/-llibopencv_flann480.dll win32: LIBS += -L$$PWD/../../OpenCV/opencv/release/install/x64/mingw/lib/-llibopencv_gapi480.dll win32: LIBS += -L$$PWD/../../OpenCV/opencv/release/install/x64/mingw/lib/-llibopencv_ml480.dll win32: LIBS += -L$$PWD/../../OpenCV/opencv/release/install/x64/mingw/lib/-llibopencv_objdetect480.dll win32: LIBS += -L$$PWD/../../OpenCV/opencv/release/install/x64/mingw/lib/-llibopencv_photo480.dll win32: LIBS += -L$$PWD/../../OpenCV/opencv/release/install/x64/mingw/lib/-llibopencv_stitching480.dll win32: LIBS += -L$$PWD/../../OpenCV/opencv/release/install/x64/mingw/lib/-llibopencv_video480.dll win32: LIBS += -L$$PWD/../../OpenCV/opencv/release/install/x64/mingw/lib/-llibopencv_videoio480.dll

INCLUDEPATH += $$PWD/../../OpenCV/opencv/release/install/include DEPENDPATH += $$PWD/../../OpenCV/opencv/release/install/include

© www.soinside.com 2019 - 2024. All rights reserved.