2
votes

I have built a very simple calculator in Qt. When I run it in release mode from qt creator, everything works fine. However when I go to the release folder and run it, it gives QT5Core.dll, QT5Widgets.dll and QT5Gui.dll not found. After running windeployqt there by:

windeployqt .

All the dll get added. However, it then gives error VCRUNTIME140_APP.dll and MSVCP140_APP.dll not found. After copying them to the folder. The exe doesn't give any error on double clicking but just does not start. What should I do? I found this solution here, however I cannot find any qml file in the application directory.

I created it as a QT widget application. I am using Windows 10 with Visual Studio 2017 and MSVC2017 64bit desktop kit. The application is in C++.

Update: Running the command

windeployqt Calculator.exe 

after adding qt to the path seems to do the trick. Application working even after removing qt from the path. Will try running the app inside vm just to be extra sure.

4
You say: however I can not find any qml file in the application directory, If you are using a .qrc it is no longer necessary to use the .qml since these are embedded in the executable - eyllanesc
Run your application from the command prompt and check if it displays an error message. - Dimitry Ernot
Maybe you can just build the exe with the dependencies? - CmosBattery
Note that Windows, in its wisdom, won’t show the stdout output of a GUI application in the command prompt. If you want to see stdout you have to eg call AllocConsole() and freopen() to get a window to appear with the stdout output in it. - Jeremy Friesner

4 Answers

1
votes

When running from the command line, add your Qt Bin directory to the PATH. For example:

C:\> PATH=C:\Qt\Qt5.11.0\5.11.0\msvc2017_64\bin;%PATH%

1
votes

You can solve the problem as selbie described it. An another way is to copy the missing .dll-Files to the folder where the.exe is placed.

See here https://doc.qt.io/Qt-5/windows-deployment.html#creating-the-application-package :

To deploy the application, we must make sure that we copy the relevant Qt DLLs (corresponding to the Qt modules used in the application) and the Windows platform plugin, qwindows.dll, as well as the executable to the same directory tree in the release subdirectory.

1
votes

set variable VCINSTALLDIR, example:

set VCINSTALLDIR=p:\Programs\Microsoft Visual Studio\2017\Community\VC\

and next run

windeployqt.exe app.exe

Or copy vc_redist.x64.exe from Redist subfolder into folder with your application.

1
votes

As @mosa mentioned, To deploy the application, we must make sure that we copy the relevant Qt DLLs (corresponding to the Qt modules used in the application) and the Windows platform plugin, qwindows.dll, as well as the executable to the same directory tree in the release subdirectory.

To add missing .dll files first open QT MSVC Console and type windeployqt.exe command,

enter image description here

Then you have to go to the directory which .exe file contains. Let's assume my .exe is in the desktop,

C:/
cd user/indrajith/desktop

Then you can add missing .dll files using following command,

 windeployqt.exe --quick.

Finally, just double click your .exe file to run the program.