ERROR: C:\OpenCV-Qt\build\bin\libopencv_core320.dll:-1: error: LNK1107: invalid or corrupt file: cannot read at 0x3D0

℡╲_俬逩灬. 提交于 2019-12-13 04:40:59

问题


I have been following this tutorial and I did all of them carefully. But afterwards I ran the simple code:

I saw this error and how can I fix it?

Tutorial: https://wiki.qt.io/How_to_setup_Qt_and_openCV_on_Windows

I removed qt and opencv and I used the version that used in the tutorial that I mentioned but I got the same error.

And also I added "img.jpg" to my project directory.

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>

using namespace std;
using namespace cv;
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    Mat image = imread("img.jpg", 1);
    namedWindow("My Image");
    imshow("My Image", image);
    waitKey(0);    
}

MainWindow::~MainWindow()
{
    delete ui;
}

and I added them to my .pro file:

INCLUDEPATH += C:\OpenCV-Qt\build\install\include
LIBS += C:\OpenCV-Qt\build\bin\libopencv_core320.dll.a
LIBS += C:\OpenCV-Qt\build\bin\libopencv_highgui320.dll
LIBS += C:\OpenCV-Qt\build\bin\libopencv_imgcodecs320.dll
LIBS += C:\OpenCV-Qt\build\bin\libopencv_imgproc320.dll
LIBS += C:\OpenCV-Qt\build\bin\libopencv_features2d320.dll
LIBS += C:\OpenCV-Qt\build\bin\libopencv_calib3d320.dll

I expect to create a window and show the image in it but I get the error:

C:\OpenCV-Qt\build\bin\libopencv_core320.dll:-1: error: LNK1107: invalid or corrupt file: cannot read at 0x3D0

来源:https://stackoverflow.com/questions/53886085/error-c-opencv-qt-build-bin-libopencv-core320-dll-1-error-lnk1107-invalid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!