简体   繁体   中英

Qt application release exe not running

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.

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%

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.

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.

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,

在此处输入图片说明

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM