LNK1107: invalid or corrupt file cannot read 0x458
-
I'm pretty new to qt and i'm trying to create a widget that showing my webcam using qt and opencv. As the title has stated that i'm stuck at the LNK1107: invalid or corrupt file cannot read 0x458. After having done some research, i discovered that this issues have been addressed in multiple topic, but not with 0x458 in particular
Any aid would be greatly appriciated, from the bottom of my heart
here's my code:
.pro:#------------------------------------------------- # # Project created by QtCreator 2019-08-10T12:27:53 # #------------------------------------------------- QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = TutorialOpenCV TEMPLATE = app # The following define makes your compiler emit warnings if you use # any feature of Qt which has been marked as deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 CONFIG += c++11 SOURCES += \ main.cpp \ mainwindow.cpp \ myvideocapture.cpp HEADERS += \ mainwindow.h \ myvideocapture.h FORMS += \ mainwindow.ui # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../opencv/build/x64/vc15/lib/ -lopencv_world451 else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../opencv/build/x64/vc15/lib/ -lopencv_world451d else:unix: LIBS += -L$$PWD/../../../../../opencv/build/x64/vc15/lib/ -lopencv_world451 INCLUDEPATH += C:\opencv\build\x64\vc15 LIBS += C:\opencv\build\x64\vc15\lib\opencv_world451.lib LIBS += C:\opencv\build\x64\vc15\lib\opencv_world451d.lib INCLUDEPATH += $$PWD/../../../../../opencv/build/include DEPENDPATH += $$PWD/../../../../../opencv/build/include INCLUDEPATH += C:\opencv\release\install\include LIBS += C:\opencv\release\bin\libopencv_core451.dll LIBS += C:\opencv\release\bin\libopencv_highgui451.dll LIBS += C:\opencv\release\bin\libopencv_imgcodecs451.dll LIBS += C:\opencv\release\bin\libopencv_imgproc451.dll LIBS += C:\opencv\release\bin\libopencv_features2d451.dll LIBS += C:\opencv\release\bin\libopencv_calib3d451.dll INCLUDEPATH += C:\opencv\release\install\include\opencv2 INCLUDEPATH += C:\opencv\release\install\include\opencv INCLUDEPATH += C:\opencv\build\include INCLUDEPATH += C:\opencv\release\include LIBS += C:\opencv\release\install\x64\mingw\bin\libopencv_core451.dll LIBS += C:\opencv\release\install\x64\mingw\bin\libopencv_highgui451.dll LIBS += C:\opencv\release\install\x64\mingw\bin\libopencv_imgcodecs451.dll LIBS += C:\opencv\release\install\x64\mingw\bin\libopencv_imgproc451.dll LIBS += C:\opencv\release\install\x64\mingw\bin\libopencv_features2d451.dll LIBS += C:\opencv\release\install\x64\mingw\bin\libopencv_calib3d451.dll
myvideocapture.cpp:
#include "myvideocapture.h" #include <QDebug> MyVideoCapture::MyVideoCapture(QObject *parent) : QThread { parent } , mVideoCap { ID_CAMERA } { } void MyVideoCapture::run() { if (mVideoCap.isOpened()) { while (true) { mVideoCap >> mFrame; if (!mFrame.empty()) { cv::rectangle(mFrame, cv::Point(10, 10), cv::Point(401, 401), cv::Scalar(0, 0, 255), 1); mPixmap = cvMatToQPixmap(mFrame); emit newPixmapCaptured(); } } } } QImage MyVideoCapture::cvMatToQImage(const cv::Mat &inMat) { switch (inMat.type()) { // 8-bit, 4 channel case CV_8UC4: { QImage image(inMat.data, inMat.cols, inMat.rows, static_cast<int>(inMat.step), QImage::Format_ARGB32); return image; } // 8-bit, 3 channel case CV_8UC3: { QImage image(inMat.data, inMat.cols, inMat.rows, static_cast<int>(inMat.step), QImage::Format_RGB888); return image.rgbSwapped(); } // 8-bit, 1 channel case CV_8UC1: { #if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0) QImage image(inMat.data, inMat.cols, inMat.rows, static_cast<int>(inMat.step), QImage::Format_Grayscale8); #else static QVector<QRgb> sColorTable; // only create our color table the first time if (sColorTable.isEmpty()) { sColorTable.resize(256 ); for (int i = 0; i < 256; ++i ) { sColorTable[i] = qRgb(i, i, i ); } } QImage image(inMat.data, inMat.cols, inMat.rows, static_cast<int>(inMat.step), QImage::Format_Indexed8 ); image.setColorTable(sColorTable ); #endif return image; } default: { qWarning()<< "ASM::cvMatToQImage()- cv::Mat image type not handled in switch:" << inMat.type(); break; } } return QImage(); } QPixmap MyVideoCapture::cvMatToQPixmap(const cv::Mat &inMat) { return QPixmap::fromImage(cvMatToQImage(inMat)); }
mainwindow.cpp:
#include "mainwindow.h" #include "ui_mainwindow.h" #include "myvideocapture.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); mOpenCV_videoCapture = new MyVideoCapture(this); connect(mOpenCV_videoCapture, &MyVideoCapture::newPixmapCaptured, this, [&]() { ui->opencvFrame->setPixmap(mOpenCV_videoCapture->pixmap().scaled(500, 500)); }); } MainWindow::~MainWindow() { delete ui; mOpenCV_videoCapture->terminate(); } void MainWindow::on_iniciarOpenCV_button_clicked() { mOpenCV_videoCapture->start(QThread::HighestPriority); }
main.cpp:
#include "mainwindow.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); a.setStyle("fusion"); MainWindow w; w.show(); return a.exec(); }
-
I'm pretty new to qt and i'm trying to create a widget that showing my webcam using qt and opencv. As the title has stated that i'm stuck at the LNK1107: invalid or corrupt file cannot read 0x458. After having done some research, i discovered that this issues have been addressed in multiple topic, but not with 0x458 in particular
Any aid would be greatly appriciated, from the bottom of my heart
here's my code:
.pro:#------------------------------------------------- # # Project created by QtCreator 2019-08-10T12:27:53 # #------------------------------------------------- QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = TutorialOpenCV TEMPLATE = app # The following define makes your compiler emit warnings if you use # any feature of Qt which has been marked as deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 CONFIG += c++11 SOURCES += \ main.cpp \ mainwindow.cpp \ myvideocapture.cpp HEADERS += \ mainwindow.h \ myvideocapture.h FORMS += \ mainwindow.ui # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../opencv/build/x64/vc15/lib/ -lopencv_world451 else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../opencv/build/x64/vc15/lib/ -lopencv_world451d else:unix: LIBS += -L$$PWD/../../../../../opencv/build/x64/vc15/lib/ -lopencv_world451 INCLUDEPATH += C:\opencv\build\x64\vc15 LIBS += C:\opencv\build\x64\vc15\lib\opencv_world451.lib LIBS += C:\opencv\build\x64\vc15\lib\opencv_world451d.lib INCLUDEPATH += $$PWD/../../../../../opencv/build/include DEPENDPATH += $$PWD/../../../../../opencv/build/include INCLUDEPATH += C:\opencv\release\install\include LIBS += C:\opencv\release\bin\libopencv_core451.dll LIBS += C:\opencv\release\bin\libopencv_highgui451.dll LIBS += C:\opencv\release\bin\libopencv_imgcodecs451.dll LIBS += C:\opencv\release\bin\libopencv_imgproc451.dll LIBS += C:\opencv\release\bin\libopencv_features2d451.dll LIBS += C:\opencv\release\bin\libopencv_calib3d451.dll INCLUDEPATH += C:\opencv\release\install\include\opencv2 INCLUDEPATH += C:\opencv\release\install\include\opencv INCLUDEPATH += C:\opencv\build\include INCLUDEPATH += C:\opencv\release\include LIBS += C:\opencv\release\install\x64\mingw\bin\libopencv_core451.dll LIBS += C:\opencv\release\install\x64\mingw\bin\libopencv_highgui451.dll LIBS += C:\opencv\release\install\x64\mingw\bin\libopencv_imgcodecs451.dll LIBS += C:\opencv\release\install\x64\mingw\bin\libopencv_imgproc451.dll LIBS += C:\opencv\release\install\x64\mingw\bin\libopencv_features2d451.dll LIBS += C:\opencv\release\install\x64\mingw\bin\libopencv_calib3d451.dll
myvideocapture.cpp:
#include "myvideocapture.h" #include <QDebug> MyVideoCapture::MyVideoCapture(QObject *parent) : QThread { parent } , mVideoCap { ID_CAMERA } { } void MyVideoCapture::run() { if (mVideoCap.isOpened()) { while (true) { mVideoCap >> mFrame; if (!mFrame.empty()) { cv::rectangle(mFrame, cv::Point(10, 10), cv::Point(401, 401), cv::Scalar(0, 0, 255), 1); mPixmap = cvMatToQPixmap(mFrame); emit newPixmapCaptured(); } } } } QImage MyVideoCapture::cvMatToQImage(const cv::Mat &inMat) { switch (inMat.type()) { // 8-bit, 4 channel case CV_8UC4: { QImage image(inMat.data, inMat.cols, inMat.rows, static_cast<int>(inMat.step), QImage::Format_ARGB32); return image; } // 8-bit, 3 channel case CV_8UC3: { QImage image(inMat.data, inMat.cols, inMat.rows, static_cast<int>(inMat.step), QImage::Format_RGB888); return image.rgbSwapped(); } // 8-bit, 1 channel case CV_8UC1: { #if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0) QImage image(inMat.data, inMat.cols, inMat.rows, static_cast<int>(inMat.step), QImage::Format_Grayscale8); #else static QVector<QRgb> sColorTable; // only create our color table the first time if (sColorTable.isEmpty()) { sColorTable.resize(256 ); for (int i = 0; i < 256; ++i ) { sColorTable[i] = qRgb(i, i, i ); } } QImage image(inMat.data, inMat.cols, inMat.rows, static_cast<int>(inMat.step), QImage::Format_Indexed8 ); image.setColorTable(sColorTable ); #endif return image; } default: { qWarning()<< "ASM::cvMatToQImage()- cv::Mat image type not handled in switch:" << inMat.type(); break; } } return QImage(); } QPixmap MyVideoCapture::cvMatToQPixmap(const cv::Mat &inMat) { return QPixmap::fromImage(cvMatToQImage(inMat)); }
mainwindow.cpp:
#include "mainwindow.h" #include "ui_mainwindow.h" #include "myvideocapture.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); mOpenCV_videoCapture = new MyVideoCapture(this); connect(mOpenCV_videoCapture, &MyVideoCapture::newPixmapCaptured, this, [&]() { ui->opencvFrame->setPixmap(mOpenCV_videoCapture->pixmap().scaled(500, 500)); }); } MainWindow::~MainWindow() { delete ui; mOpenCV_videoCapture->terminate(); } void MainWindow::on_iniciarOpenCV_button_clicked() { mOpenCV_videoCapture->start(QThread::HighestPriority); }
main.cpp:
#include "mainwindow.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); a.setStyle("fusion"); MainWindow w; w.show(); return a.exec(); }
@NoobDude12343 Please post whole error message. It is not even clear what file causes the problem!
-
I'm pretty new to qt and i'm trying to create a widget that showing my webcam using qt and opencv. As the title has stated that i'm stuck at the LNK1107: invalid or corrupt file cannot read 0x458. After having done some research, i discovered that this issues have been addressed in multiple topic, but not with 0x458 in particular
Any aid would be greatly appriciated, from the bottom of my heart
here's my code:
.pro:#------------------------------------------------- # # Project created by QtCreator 2019-08-10T12:27:53 # #------------------------------------------------- QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = TutorialOpenCV TEMPLATE = app # The following define makes your compiler emit warnings if you use # any feature of Qt which has been marked as deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 CONFIG += c++11 SOURCES += \ main.cpp \ mainwindow.cpp \ myvideocapture.cpp HEADERS += \ mainwindow.h \ myvideocapture.h FORMS += \ mainwindow.ui # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../opencv/build/x64/vc15/lib/ -lopencv_world451 else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../opencv/build/x64/vc15/lib/ -lopencv_world451d else:unix: LIBS += -L$$PWD/../../../../../opencv/build/x64/vc15/lib/ -lopencv_world451 INCLUDEPATH += C:\opencv\build\x64\vc15 LIBS += C:\opencv\build\x64\vc15\lib\opencv_world451.lib LIBS += C:\opencv\build\x64\vc15\lib\opencv_world451d.lib INCLUDEPATH += $$PWD/../../../../../opencv/build/include DEPENDPATH += $$PWD/../../../../../opencv/build/include INCLUDEPATH += C:\opencv\release\install\include LIBS += C:\opencv\release\bin\libopencv_core451.dll LIBS += C:\opencv\release\bin\libopencv_highgui451.dll LIBS += C:\opencv\release\bin\libopencv_imgcodecs451.dll LIBS += C:\opencv\release\bin\libopencv_imgproc451.dll LIBS += C:\opencv\release\bin\libopencv_features2d451.dll LIBS += C:\opencv\release\bin\libopencv_calib3d451.dll INCLUDEPATH += C:\opencv\release\install\include\opencv2 INCLUDEPATH += C:\opencv\release\install\include\opencv INCLUDEPATH += C:\opencv\build\include INCLUDEPATH += C:\opencv\release\include LIBS += C:\opencv\release\install\x64\mingw\bin\libopencv_core451.dll LIBS += C:\opencv\release\install\x64\mingw\bin\libopencv_highgui451.dll LIBS += C:\opencv\release\install\x64\mingw\bin\libopencv_imgcodecs451.dll LIBS += C:\opencv\release\install\x64\mingw\bin\libopencv_imgproc451.dll LIBS += C:\opencv\release\install\x64\mingw\bin\libopencv_features2d451.dll LIBS += C:\opencv\release\install\x64\mingw\bin\libopencv_calib3d451.dll
myvideocapture.cpp:
#include "myvideocapture.h" #include <QDebug> MyVideoCapture::MyVideoCapture(QObject *parent) : QThread { parent } , mVideoCap { ID_CAMERA } { } void MyVideoCapture::run() { if (mVideoCap.isOpened()) { while (true) { mVideoCap >> mFrame; if (!mFrame.empty()) { cv::rectangle(mFrame, cv::Point(10, 10), cv::Point(401, 401), cv::Scalar(0, 0, 255), 1); mPixmap = cvMatToQPixmap(mFrame); emit newPixmapCaptured(); } } } } QImage MyVideoCapture::cvMatToQImage(const cv::Mat &inMat) { switch (inMat.type()) { // 8-bit, 4 channel case CV_8UC4: { QImage image(inMat.data, inMat.cols, inMat.rows, static_cast<int>(inMat.step), QImage::Format_ARGB32); return image; } // 8-bit, 3 channel case CV_8UC3: { QImage image(inMat.data, inMat.cols, inMat.rows, static_cast<int>(inMat.step), QImage::Format_RGB888); return image.rgbSwapped(); } // 8-bit, 1 channel case CV_8UC1: { #if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0) QImage image(inMat.data, inMat.cols, inMat.rows, static_cast<int>(inMat.step), QImage::Format_Grayscale8); #else static QVector<QRgb> sColorTable; // only create our color table the first time if (sColorTable.isEmpty()) { sColorTable.resize(256 ); for (int i = 0; i < 256; ++i ) { sColorTable[i] = qRgb(i, i, i ); } } QImage image(inMat.data, inMat.cols, inMat.rows, static_cast<int>(inMat.step), QImage::Format_Indexed8 ); image.setColorTable(sColorTable ); #endif return image; } default: { qWarning()<< "ASM::cvMatToQImage()- cv::Mat image type not handled in switch:" << inMat.type(); break; } } return QImage(); } QPixmap MyVideoCapture::cvMatToQPixmap(const cv::Mat &inMat) { return QPixmap::fromImage(cvMatToQImage(inMat)); }
mainwindow.cpp:
#include "mainwindow.h" #include "ui_mainwindow.h" #include "myvideocapture.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); mOpenCV_videoCapture = new MyVideoCapture(this); connect(mOpenCV_videoCapture, &MyVideoCapture::newPixmapCaptured, this, [&]() { ui->opencvFrame->setPixmap(mOpenCV_videoCapture->pixmap().scaled(500, 500)); }); } MainWindow::~MainWindow() { delete ui; mOpenCV_videoCapture->terminate(); } void MainWindow::on_iniciarOpenCV_button_clicked() { mOpenCV_videoCapture->start(QThread::HighestPriority); }
main.cpp:
#include "mainwindow.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); a.setStyle("fusion"); MainWindow w; w.show(); return a.exec(); }
@NoobDude12343 Please don't double post, you have already raise this issue in this post...
-
Double post - locked.