Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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```

    d3995349-0bcd-4533-a25a-e3565cfbebed-image.png

    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


  • Lifetime Qt Champion

    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
    72f7671c-b31d-4161-bd7c-fb0390ea47b4-image.png

    so, i opened command prompt and did this 2.JPG

    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 ?
    f4edf384-c93c-4048-b130-dc74c22c6135-image.png



  • @learnist
    In that "Release" directory I see the Qt5...dll names all end in the letter d (just before the .dll). That means they are compiled for debug. And the GAF...pdb files also come from debug compilation. The error message shows it is looking instead for Qt5Widget.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).



  • This post is deleted!


    1. 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.
    2. To force deploying the release binaries, add --release after windeployqt.