简体   繁体   中英

Qt Creator LNK2019:Unresolved external symbol using OpenCV

I've been trying to compile a project for the past two days in Qt using OpenCV but can't figure out why it doesn't. My application has only main.cpp , widget.cpp and widget.h

here is my .pro file

  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

and these are the errors I keep getting:

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)

Can anyone explain why and how I an get rid of these please?

Thanks!

Put a slash at the end of every file in LIBS and save it.

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

Now right click the project folder and click "Run qmake" and then 'build' it, this will 'make' the file and consider the changes made in .pro file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM