Qt 4 New project - The program has unexpectedly finished
-
I'm using Qt Creator 4.13.2 with Qt 5.15.1 and MinGW 32-bit on 64-bit Windows 10 with no problem. I needed Qt 4 for an older project and downloaded qt-opensource-windows-x86-mingw482-4.8.7.exe and installed the exe file. In Qt Creator, I added this Qt version (C:\Qt\4.8.7\bin\qmake.exe) and created a new kit using that version. But when I just create a new project (mainwindow e.g. without adding any code to the project), it is built successfully but does not run and crashes with this error: The program has unexpectedly finished.
When I change the kit and use qt 5, it's OK. I've also changed the MinGW and used MinGW 32-bit 4.8.2, but still have the same error. What could be the problem. Thanks -
I'm using Qt Creator 4.13.2 with Qt 5.15.1 and MinGW 32-bit on 64-bit Windows 10 with no problem. I needed Qt 4 for an older project and downloaded qt-opensource-windows-x86-mingw482-4.8.7.exe and installed the exe file. In Qt Creator, I added this Qt version (C:\Qt\4.8.7\bin\qmake.exe) and created a new kit using that version. But when I just create a new project (mainwindow e.g. without adding any code to the project), it is built successfully but does not run and crashes with this error: The program has unexpectedly finished.
When I change the kit and use qt 5, it's OK. I've also changed the MinGW and used MinGW 32-bit 4.8.2, but still have the same error. What could be the problem. Thanks@mfaghani
If you run it from Creator via the Debug button, do you get a stack trace when it finishes unexpectedly? That may give you a clue as to where it has reached. One possibility is that the Qt4 version is finding artefacts lying around/on its path from Qt5 and that is a problem? -
I don't get any stack trace in debug mode. And I don't get any return code in Application Output window. Qt5 is on a separated path from Qt4 on my PC, but both on a same drive as bellow.
C:\Qt\4.8.7
C:\Qt5 -
I'm using Qt Creator 4.13.2 with Qt 5.15.1 and MinGW 32-bit on 64-bit Windows 10 with no problem. I needed Qt 4 for an older project and downloaded qt-opensource-windows-x86-mingw482-4.8.7.exe and installed the exe file. In Qt Creator, I added this Qt version (C:\Qt\4.8.7\bin\qmake.exe) and created a new kit using that version. But when I just create a new project (mainwindow e.g. without adding any code to the project), it is built successfully but does not run and crashes with this error: The program has unexpectedly finished.
When I change the kit and use qt 5, it's OK. I've also changed the MinGW and used MinGW 32-bit 4.8.2, but still have the same error. What could be the problem. Thanks@mfaghani do you have the correct compiler? IIRC the precompiled qt libs for qt4 are now over 12 years old. I'm not sure how far you can go back with gcc's backwards compatibility. I do know that you would need MSVC2008 if you used MSVC compiler
-
I've tried to change the compiler as was mentioned on the post above and the problem solved. I've downloaded this MinGW-builds and copied only its MinGW folder to my C drive. Then added it in Qt Creator>Tools>Options>Kits>Compilers and set it as the compiler for Qt 4 kit. I've just had another error with this compiler with the keyword
nullptr, which was solved by putting the lineQMAKE_CXXFLAGS += -std=c++0xin.profile got from here.
Now I can compile and run a new project.
Thanks for help