错误:C:\ OpenCV-Qt \ build \ bin \ libopencv_core320.dll:-1:错误:LNK1107:无效或损坏的文件:无法在0x3D0读取

时间:2018-12-21 14:02:52

标签: c++ qt opencv windows-10 qmake

我一直在遵循本教程,并且我认真地做了所有这些。 但是之后,我运行了简单的代码:

我看到了这个错误,该如何解决?

教程: https://wiki.qt.io/How_to_setup_Qt_and_openCV_on_Windows

我删除了qt和opencv,并使用了我在前面提到的教程中使用的版本,但是遇到了同样的错误。

我也将“ img.jpg”添加到了项目目录中。

#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;
}

,然后将它们添加到我的.pro文件中:

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

我希望创建一个窗口并在其中显示图像,但出现错误:

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

0 个答案:

没有答案