Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt 4 New project - The program has unexpectedly finished
Qt 6.11 is out! See what's new in the release blog

Qt 4 New project - The program has unexpectedly finished

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 4 Posters 699 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mfaghani
    wrote on last edited by mfaghani
    #1

    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

    JonBJ J.HilkJ 2 Replies Last reply
    0
    • M mfaghani

      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

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @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?

      1 Reply Last reply
      1
      • M Offline
        M Offline
        mfaghani
        wrote on last edited by mfaghani
        #3

        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

        jsulmJ 1 Reply Last reply
        0
        • M mfaghani

          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

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @mfaghani Please set QT_DEBUG_PLUGINS to 1 in Run settings of your app in QtCreator and try to run it: you should get a lot of debug output for plug-ins - see whether there are any errors.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          2
          • M mfaghani

            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

            J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on last edited by
            #5

            @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


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            1 Reply Last reply
            3
            • M Offline
              M Offline
              mfaghani
              wrote on last edited by
              #6

              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 line QMAKE_CXXFLAGS += -std=c++0x in .pro file got from here.
              Now I can compile and run a new project.
              Thanks for help

              1 Reply Last reply
              2

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved