I'm new to Qt and I have a project that needs to configure OpenCV in Qt , I tried to run a simple code in Qt but I got this error "undefined reference to cv::imread(std::string const&, int)
"
and here is my code...
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
using namespace cv;
int main(){
Mat src,gray;
src=imread("C:/Users/user/Desktop/wood-pattern.png",1);
imshow("gg",src);
cvWaitKey(0);
return 0;
}
and my source.pro is
#-------------------------------------------------
#
# Project created by QtCreator 2014-08-24T20:38:56
#
#-------------------------------------------------
INCLUDEPATH += C:\opencv\opencv2.4.9\build\include\
CONFIG(release,debug|release)
{
LIBS += C:\opencv\opencv2.4.9\build\x86\vc11\lib\opencv_calib3d249.lib \
C:\opencv\opencv2.4.9\build\x86\vc11\lib\opencv_contrib249.lib \
C:\opencv\opencv2.4.9\build\x86\vc11\lib\opencv_core249.lib \
C:\opencv\opencv2.4.9\build\x86\vc11\lib\opencv_features2d249.lib \
C:\opencv\opencv2.4.9\build\x86\vc11\lib\opencv_flann249.lib \
C:\opencv\opencv2.4.9\build\x86\vc11\lib\opencv_gpu249.lib \
C:\opencv\opencv2.4.9\build\x86\vc11\lib\opencv_highgui249.lib \
C:\opencv\opencv2.4.9\build\x86\vc11\lib\opencv_imgproc249.lib \
C:\opencv\opencv2.4.9\build\x86\vc11\lib\opencv_legacy249.lib \
C:\opencv\opencv2.4.9\build\x86\vc11\lib\opencv_ml249.lib \
C:\opencv\opencv2.4.9\build\x86\vc11\lib\opencv_objdetect249.lib \
C:\opencv\opencv2.4.9\build\x86\vc11\lib\opencv_ts249.lib \
C:\opencv\opencv2.4.9\build\x86\vc11\lib\opencv_video249.lib
}
CONFIG(debug,debug|release)
{
LIBS += C:\opencv\opencv2.4.9\build\x64\vc11\lib\opencv_calib3d249.lib \
C:\opencv\opencv2.4.9\build\x64\vc11\lib\opencv_contrib249.lib \
C:\opencv\opencv2.4.9\build\x64\vc11\lib\opencv_core249.lib \
C:\opencv\opencv2.4.9\build\x64\vc11\lib\opencv_features2d249.lib \
C:\opencv\opencv2.4.9\build\x64\vc11\lib\opencv_flann249.lib \
C:\opencv\opencv2.4.9\build\x64\vc11\lib\opencv_gpu249.lib \
C:\opencv\opencv2.4.9\build\x64\vc11\lib\opencv_highgui249.lib \
C:\opencv\opencv2.4.9\build\x64\vc11\lib\opencv_imgproc249.lib \
C:\opencv\opencv2.4.9\build\x64\vc11\lib\opencv_legacy249.lib \
C:\opencv\opencv2.4.9\build\x64\vc11\lib\opencv_ml249.lib \
C:\opencv\opencv2.4.9\build\x64\vc11\lib\opencv_objdetect249.lib \
C:\opencv\opencv2.4.9\build\x64\vc11\lib\opencv_ts249.lib \
C:\opencv\opencv2.4.9\build\x64\vc11\lib\opencv_video249.lib \
}
QT += core
QT -= gui
TARGET = Source
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
I saw all the answers about but they didn't work. my Qt is 32bit and my Windows is 64bit. I think my configuration is wrong. I followed many tutorial but they weren't for OpenCV 2.4.9 so please help me ...