undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)' with QT5.8
My pltform:
- Win10 64bit
- QT58(mingw53)
after installing opencv 3.30, I write code:
//main.cc
#include <iostream>
#include <QDir>
#include <qdebug>
#include "opencv2/opencv.hpp"
using namespace std;
int main()
{
qDebug()<< QDir::currentPath();
cv::Mat image = cv::imread("1.jpg",1);
std::cout << image.cols << " " << image.rows << std::endl;
if(image.data == 0){
cout << "No Image" <<endl;
}
else{
cout << "Image" << endl;
}
cv::namedWindow("My Image");
cv::imshow("My Image", image);
system("pause");
return 0;
}
I get the error, like this:
release/main.o:main.cpp:(.text.startup+0x170): undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)'
collect2.exe: error: ld returned 1 exit status
I dont know why, but other functions work well,expect imshow()
. And I did add the LIBS:
//qt.pro
INCLUDEPATH += D:\opencv\build\mingw\include
LIBS += D:\opencv\build\mingw\x86\mingw\bin\libopencv_highgui330.dll
LIBS += D:\opencv\build\mingw\x86\mingw\bin\libopencv_calib3d330.dll
LIBS += D:\opencv\build\mingw\x86\mingw\bin\libopencv_dnn330.dll
LIBS += D:\opencv\build\mingw\x86\mingw\bin\libopencv_features2d330.dll
LIBS += D:\opencv\build\mingw\x86\mingw\bin\libopencv_flann330.dll
LIBS += D:\opencv\build\mingw\x86\mingw\bin\libopencv_imgcodecs330.dll
LIBS += D:\opencv\build\mingw\x86\mingw\bin\libopencv_imgproc330.dll
LIBS += D:\opencv\build\mingw\x86\mingw\bin\libopencv_ml330.dll
LIBS += D:\opencv\build\mingw\x86\mingw\bin\libopencv_objdetect330.dll
LIBS += D:\opencv\build\mingw\x86\mingw\bin\libopencv_photo330.dll
LIBS += D:\opencv\build\mingw\x86\mingw\bin\libopencv_shape330.dll
LIBS += D:\opencv\build\mingw\x86\mingw\bin\libopencv_stitching330.dll
LIBS += D:\opencv\build\mingw\x86\mingw\bin\libopencv_superres330.dll
LIBS += D:\opencv\build\mingw\x86\mingw\bin\libopencv_video330.dll
LIBS += D:\opencv\build\mingw\x86\mingw\bin\libopencv_videoio330.dll
LIBS += D:\opencv\build\mingw\x86\mingw\bin\libopencv_videostab330.dll
LIBS += D:\opencv\build\mingw\x86\mingw\bin\opencv_ffmpeg330.dll
LIBS += D:\opencv\build\mingw\x86\mingw\bin\libopencv_core330.dll