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

qtqt-creatorqt5.8

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 it's 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 this 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

Best Answer

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.

Basically, to make sure we can use Qt5.8.0+ on Windows (including Qt WebEngine), we need to install both:

Related Topic