I am working on windows 7, and installed and compiled OPENCV 2.4.6, it worked perfectly well with microsoft studio 2012, so I know how to find the path of OPENCV include and lib, and configure the path of bin in the system variables
But when it comes to QT, it totally didn't work at all. I know on the stackoverflow there are many questions about how to link opencv with QT in windows, But I tried all the answers, but it never worked out for me.
Here is my configuration which works for visual studio 2012.
system variable path:
- D:\Program Files\opencv\build\x64\vc11\bin;
include path:
- D:\Program Files\opencv\build\include\;
- D:\Program Files\opencv\build\include\opencv;
- D:\Program Files\opencv\build\include\opencv2;
lib path:
- D:\Program Files\opencv\build\x64\vc11\lib;
I have downloaded and installed QT 5.1.1, and started a project. In the pro, I edited like this,
INCLUDEPATH += D:\Program Files\opencv\build\include \
I assume this should be working, but in the main(), when I added the header
#include "opencv/cv.h"
#include <opencv/highgui.h>
QT compiler will always tell me 'no such file or directory'
This kind of stupid problem has stuck me in for days, I don't know where it goes wrong, could some people help me.
update: Thanks for everybody, Gibby's answer has helped me to solve the first issue of 'headers can't be found', but now then running the program, I got issues like 'release\test.exe:-1: error:LNK1120: 6 unresolved externals'
so it is definitely due to the linking of libraries , I have tried
LIBS += -LD:\Program Files\opencv\build\x64\vc11\lib \
-lopencv_core246 \
-lopencv_highgui246 \
-lopencv_imgproc246 \
-lopencv_features2d246 \
-lopencv_calib3d246 \
or
LIBS += -LD:\Program Files\opencv\build\x64\vc11\lib \
-lopencv_core246.lib \
-lopencv_highgui246.lib \
-lopencv_imgproc246.lib \
-lopencv_features2d246.lib \
-lopencv_calib3d246.lib \
or from How to link opencv in QtCreator and use Qt library
LIBS += -LD:\Program Files\opencv\build\x64\vc11\lib \
libopencv_core246 \
libopencv_highgui246 \
libopencv_imgproc246 \
libopencv_features2d246 \
libopencv_calib3d246 \
but none of these work