How to deploy Qt C++ Application on Windows when i used Visual Studio to create my application
-
I just Build my Project and now when i click the executable file (.exe), i gives errors that some .dll files are missing, so i referred this page https://doc.qt.io/qt-5/windows-deployment.html which says that i can use Windows Deployment Tool, which is found in
QTDIR/bin/windeployqt
folder directory, but when i go to the path in the image c\Qt\5.14.1```i see all of these folders and all of them have bin folders and all bin folders have the windeployqt.exe , so my question is which one do i use, since i used Visual Studio 2019. and from the link documentation,
The simplest way to use windeployqt is to add the bin directory of your Qt installation (e.g. <QT_DIR\bin>) to the PATH variable and then run: windeployqt <path-to-app-binary>
i understood that Step-1 > i need to open command prompt in administrator role.
Step-2 > i need to type ```
set PATH = C\Qt\5.14.1\ anyone\which one of all those folders.Step-3 > i need to type windeployqt
C:\projects\GAF_Updated\GAF\x64\Release\project_name.exe
-
Hi,
Use the version that matches the Qt version you used to build your application.
-
@SGaist Thanks for the suggestion, i went into visual studio , Extensions->QT VS Tools-> Qt options and this thing shows up ,where i got to know the version i am using
so, i opened command prompt and did this
so , in my applications .exe folder, i see some more .dll files being added, but still i get the same errors
missing Qt5Widgets.dll,Qt5Core.dll,Qt5Gui.dll, i have all of those but the name ends with d, should i try renaming them ?
-
@learnist
In that "Release" directory I see theQt5...dll
names all end in the letterd
(just before the.dll
). That means they are compiled for debug. And theGAF...pdb
files also come from debug compilation. The error message shows it is looking instead forQt5Widget.dll
, which is not compiled for debug.You need to sort out why this is. You should not be deploying debug builds, only release ones (unless you know what you are doing).
-
- To solve the VCINSTALLDIR problem, start the command prompt from your start menu -> Visual Studio 2017 -> x64 Native Tools Command Prompt (be sure not the ones with x86)
Then call :
set PATH=C:\Qt\5.14.1\msvc2017_64\bin;%PATH%
to make both vc and qt dirs in your PATH. - To force deploying the release binaries, add
--release
after windeployqt.
- To solve the VCINSTALLDIR problem, start the command prompt from your start menu -> Visual Studio 2017 -> x64 Native Tools Command Prompt (be sure not the ones with x86)