Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV with QT cv::imread problem.

Dear QT an OpenCV users,

I have installed with CMake actual OpenCV 3.0.0 on my machine. I'm using QT Creator 5.3 with MinGW 32bit (my OS is Win7 64bit).

This simple example code is successfully compiled:

#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
int main(int argc, char *argv[])
Mat output = Mat::zeros(120,350,CV_8UC3);
putText(output,"Hello World :)", cvPoint(15,70),FONT_HERSHEY_PLAIN,3, cvScalar(0,255,0),4);
return 0;

It works! So my .pro file, headers, libs, patch etc. should be ok...

But when I try to use something my own, by adding just one line to this code like this:

Mat src = imread("C:/test.bmp",1);

I get the following error during compilation:

undefined reference to `cv::imread(cv::String const&, int)'

I don't really know what I'm doing wrong :( I have been searching in google etc. People have this issue but they have undefined references with all cv:: functions. I can't understand what is wrong there if my example code works (cv::imshow etc. are works).

Those libs in my .pro file are not enought? Please, have a look:

INCLUDEPATH += E://OpenCV//release//install//include
LIBS += "E:\OpenCV\release\lib\libopencv_core300.dll.a"
LIBS += "E:\OpenCV\release\lib\libopencv_highgui300.dll.a"
LIBS += "E:\OpenCV\release\lib\libopencv_imgproc300.dll.a"
LIBS += "E:\OpenCV\release\lib\libopencv_features2d300.dll.a"
LIBS += "E:\OpenCV\release\lib\libopencv_calib3d300.dll.a"

Thanks a lot in advance for any help.