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


  • Lifetime Qt Champion


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

  • @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.