How to link opencv in QtCreator and use Qt library
The originally accepted answer did not work for me, I am running MSVC2013 Professional and QT5.9. I found SIMPLE and SUREFIRE CROSS-PLATFORM solution that should help anyone who is trying to link an external library (like openCV) with QT.
The steps listed below are found in the Qt5 documentation: http://doc.qt.io/qtcreator/creator-project-qmake-libraries.html under the "To Add Library" section.
- Right click on the project file located in the 'project pane' on the left side of the creator... and select "Add Library..."
- Follow the instructions of the wizard
Let me add some specificity from here:
- Select "External Library"
- For the "Library File" navigate to your opencv_worldXXX.lib file (or opencv_worldXXXd.lib file, you will notice that by specifying only one or the other the wizard has a checkbox which includes the other automatically) [ex. ...\opencv\build\x64\vc12\lib\opncv_world310.lib]
- For the "Include Folder" navigate to the "include" folder within the build. [ex. ...\opencv\build\include]
- Select your operating system, dynamic/static library (whichever is appropriate)
- Hit NEXT, CLEAN UP, and RUN!
Finally I am starting to be happy. When adjusting this question I had to try all the ways how to define LIBS. Listing them manually helped, at first I wrote them somehow wrong.
This is how it works finally:
LIBS += -LC:\\Programs\\opencv24\\opencv_bin2\\bin \
libopencv_core240d \
libopencv_highgui240d \
libopencv_imgproc240d \
libopencv_features2d240d \
libopencv_calib3d240d \