Error when Loading QImage
-
What compiler do you use? How did you install Qt and please show your CMakeLists.txt.
-
@Christian-Ehrlicher I'm using LLVM MinGW 64 with Qt 6.7.1 in my Qt Creator kit. I installed Qt through the open source installer on the website (https://www.qt.io/download-qt-installer-oss?hsCtaTracking=99d9dd4f-5681-48d2-b096-470725510d34|074ddad0-fdef-4e53-8aa8-5e8a876d6ab4). I installed Qt 6.7.1 through the Qt Creator maintenance tool. I also made the project using QMake, so I don't think I have a CMakeLists.txt file. Here's the .pro file though:
QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets CONFIG += c++17 CONFIG += console # You can make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ main.cpp \ mainwindow.cpp HEADERS += \ mainwindow.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
-
Just to be sure it crashes in the test.load() statement, if you add a qDebug() directly after, you don't see any output from it in Qt Creator, like ...*QImage( ..." etc.? Say like this:
#include "mainwindow.h" #include <QApplication> #include "qdebug.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; QImage test; test.load("C:/IMAGES/IMAGE.png"); // crashes program qDebug() << test; w.show(); return a.exec(); }
-
@hskoglund I tried that and the program seems to just stop and crash when I load (without displaying anything in the console with the qDebug). I also tried to qDebug a basic message after the load, but it doesn't seem to print that either.
-
@hskoglund Yes. I also have MinGW installed separately on my computer so I could try quickly making another kit with those and see if it works.
Edit: Changing the version of MinGW in the kit worked! I tried using regular MinGW 64-bit and that made it work perfectly. Thanks so much
-
-