Cannot run Qt example in Qt creator: The program has unexpectedly finished



  • Recently I tried to upgrade Qt to 5.8.0 on Windows 7 32bit from Qt5.6.2 MSVC 2013, and I saw strange issues.

    I downloaded and installed Visual Studio 2015 from this link: https://www.visualstudio.com/downloads/

    After I installed Qt 5.8.0 MSVC 2015 version, Qt Creator 4.2.1 can be launched. From the welcome page, I selected the example named: "Address Book Example". And then after clicking "Configure" project, the project is listed in Qt Creator.

    Now I tried to build the project, which was successful. But when I tried to run the project, I got the following error messages:

    Starting C:\Qt\Examples\Qt-5.8\widgets\itemviews\build-addressbook-Desktop_Qt_5_8_0_MSVC2015_32bit-Debug\debug\addressbook.exe...
    The program has unexpectedly finished.
    C:\Qt\Examples\Qt-5.8\widgets\itemviews\build-addressbook-Desktop_Qt_5_8_0_MSVC2015_32bit-Debug\debug\addressbook.exe crashed.
    

    I didn't see this kind of error before when I was using Qt5.6.2 with MSVC 2013. I also tried the following things:

    • Reinstall Qt5.8.0 MSVC 2015 using offline installer
    • Reinstall Qt5.7.1 MSVC 2015 using offline installer
    • Reinstall Qt5.6.2 MSVC 2015 using offline installer
    • Reinstall Qt5.8.0 using online installer, in which I chose MSVC 2013 and MSVC 2015

    I still kept getting the same error messages.

    When I went to the debug folder, double clicked the exe file, it said some Qt dlls were missing. I then manually copied to the debug folder, then the exe can be run with no problem.

    Now I want to run app from inside Qt Creator, but not sure what is the issue with Qt Creator 4.2.1. I researched in Google for a few hours, but still cannot find out the reason why Qt Creator cannot run projects even it's own Example projects. (same errors for my own projects)

    I feel it must be something to do with Qt creator environment/settings. Anyone has any ideas about this problem?

    Update 1:

    I tried to use MinGW with Qt Creator, the addressbook example can be run correctly. Looks like the crashing issue is related to MSVC 2015. I need MSVC 2015, because all other environments don't support webenginewidgets, and I got:

    :-1: error: Unknown module(s) in QT: webenginewidgets

    Not sure if the crashing issue is a bug in Qt or Qt creator.

    Update 2:

    In my Qt Creator, I saw warning icons for MSVC 2013 and MSVC 2015 compilers, please see the screenshots below:
    enter image description here
    enter image description here


  • Moderators

    @JakeW You should try to debug. But first you need to install Microsoft debugger: http://doc.qt.io/qtcreator/creator-debugger-engines.html



  • The problem is mostly likely in your configuration,

    For example I doubt you could use GDB to debug MVC generated code.



  • Hi @jsulm and @Oleksandr-Malyushytskyy thanks for your reply.

    I installed Microsoft Windows SDK debugging tools, and configure with Qt Creator, and tried to debug. I put a breakpoint in the first line of main method. But it didn't reach that point at all. The debugger simple quit immediately.

    I assume after a complete installation of Qt 5.8.0 and MSVC 2015, I should be able to run Examples without any custom configurations. But the example couldn't be run with 'crashed' messages. Maybe Windows 7 32bit is too old, and no tests against this operating system for latest Qt releases?

    I'm trying to setup Qt 5.8.0 with MSVC 2015 on Windows 10 and see how it works.



  • If main it is not reached it is typically a sign of incompatible runtime libraries (for example different CRTs, mix of the libraries built with different compilers. etc.



  • @Oleksandr-Malyushytskyy I was able to run the exe manually from the debug folder after I copied dlls over.

    So I guess my system may have multiple runtime libraries, and Qt Creator found the wrong one? Perhaps I should clean everything and try reinstalling?



  • I finally resolved the issue. The reason is that the Windows 10 SDK is missing.

    After I download and install all default components of the Windows 10 SDK, everything worked on Windows 7 32bit.



  • This was probably required by Qt binaries you installed,



  • @Oleksandr-Malyushytskyy Yes possibly. Could be Qt WebEngine.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.