Код: Выделить всё
// vscode
using namespace cv;
Mat image = imread("C:\\Users\\Documents\\Screenshot 2023-07-30 205234.png");
imshow("Output", image);
Код: Выделить всё
#.pri
INCLUDEPATH += D:/data/opencv-4.10.0/opencv-4.10.0/_build/install/include
Debug:{
LIBS += D:/data/opencv-4.10.0/opencv-4.10.0/_build/install/x64/vc17/lib/opencv_world4100d.lib
}
Release:{
LIBS += D:/data/opencv-4.10.0/opencv-4.10.0/_build/install/x64/vc17/lib/opencv_world4100.lib
}
Код: Выделить всё
// qform
#include "mainwindow.h"
#include
#include "opencv2/opencv.hpp"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
cv::Mat image = cv::imread("C:/Users/邵长虹/Documents/Screenshot 2023-07-30 205234.png");
cv::imshow("Output", image);
MainWindow w;
w.show();
return a.exec();
}
Код: Выделить всё
debug/main.o: in function qMain(int, char ** )':
undefined reference to `cv::imread(std::__cxx11::basic_string const&, int)'
D:\QTProject\MyFirstQtProject\build\Desktop_Qt_6_72_MinGW_64_bit-Debug/../../main.cpp:11: undefined reference to `cv::imshow(std::__cxx11::basic_string const&, cv::_InputArray const&)'
D:\QTProject\MyFirstQtProject\build\Desktop_Qt_6_7_2_MinGW_64_bit-Debug/../../main.cpp:15: undefined reference to 'cv::Mat::~Mat0'
D:\QTProject\MyFirstQtProject\build\Desktop_Qt_6_7_2_MinGW_64_bit-Debug/../../main.cpp:15: undefined reference to 'cv::Mat::~Mat0'
collect2.exe: error: Id returned 1 exit status
Included header opencv.hpp is not used directly (fix available)
Это пример кода из моего справочного листа:
Код: Выделить всё
INCLUDEPATH += c:/dev/opencv/build/install/include
Debug: {
LIBS += -lc:/dev/opencv/build/install/x86/vc14/lib/opencv_world330d
}
Release: {
LIBS += -lc:/dev/opencv/build/install/x86/vc14/lib/opencv_world330
}
Я использую компилятор MinGW. Что я могу сделать, чтобы это исправить?
Подробнее здесь: https://stackoverflow.com/questions/786 ... qt-creator