Qt Creator LNK2019:使用OpenCV的未解析的外部符号

时间:2014-11-06 11:33:48

标签: c++ qt opencv

我一直在尝试使用QtOpenCV中编译过去两天的项目,但无法弄清楚它为什么没有。我的应用只有main.cppwidget.cppwidget.h

这是我的.pro文件

  QT       += core gui opengl
  greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

  TARGET = FaceDetect
  TEMPLATE = app
  SOURCES += main.cpp\
             widget.cpp

  HEADERS  += widget.h

  FORMS    += widget.ui

  INCLUDEPATH += C:/opencv/build/include/
  LIBS += -LC:/opencv/build/x64/vc10/lib/
           -libopencv_core2410
           -libopencv_highgui2410
           -libopencv_imgproc2410
           -libopencv_features2d2410
            -libopencv_calib3d24610

这些是我不断得到的错误:

main.obj:-1: error: LNK2019: unresolved external symbol "public: void __thiscall cv::Mat::deallocate(void)" (?deallocate@Mat@cv@@QAEXXZ) referenced in function "public: void __thiscall cv::Mat::release(void)" (?release@Mat@cv@@QAEXXZ)    

moc_widget.obj:-1: error: LNK2001: unresolved external symbol "public: void __thiscall cv::Mat::deallocate(void)" (?deallocate@Mat@cv@@QAEXXZ)

moc_widget.obj:-1: error: LNK2001: unresolved external symbol "public: void __thiscall cv::Mat::deallocate(void)" (?deallocate@Mat@cv@@QAEXXZ)

任何人都可以解释为什么以及如何摆脱这些?

谢谢!

1 个答案:

答案 0 :(得分:0)

在LIBS中的每个文件末尾添加斜杠并保存。

LIBS += -LC:/opencv/build/x64/vc10/lib/
       -libopencv_core2410 \
       -libopencv_highgui2410 \
       -libopencv_imgproc2410 \ 
       -libopencv_features2d2410 \ 
       -libopencv_calib3d24610

现在右键单击项目文件夹,然后单击"运行qmake"然后建立'它,这将“制造”#39;该文件并考虑.pro文件中所做的更改。