Important: Please read the Qt Code of Conduct -

Can't deploy .exe on Windows

  • I'm trying to figure out how to create an executable that I can deploy to Windows machines that do not have Qt installed. As a test, I created a new default Qt Widget project. I then compiled release versions for both mingw-32 and MSVC2017 toolkits. I then copied the final .exe file into an empty directory (I used different empty directories for both binaries) and executed the command:

    C:\Qt\5.12.3\mingw73_32\bin\windeployqt.exe .

    This copied a lot of DLLs into my deployment directory. However, I am still unable to run my executables. The mingw_32 complains that it cannot find libgcc_s_dw2-1.dll and the MSVC2017 just says that it is unable to start correctly.

    If I add C:\Qt\5.12.3\mingw73_32\bin to my PATH then the mingw_32 release will run correctly, but obviously I cannot expect my users to have this on their system.

    How can I create a release of this test app?

  • @kitfox said in Can't deploy .exe on Windows:

    I cannot expect my users to have this on their system

    You need to deploy libgcc_s_dw2-1.dll to the machines you intend to run your mingw built Qt app

  • @Pablo-J.-Rogina Trouble is, if I include libgcc_s_dw2-1.dll (and libwinpthread-1.dll which it depends on), I get a bunch of errors about procedure entry points not being found. It also doesn't explain why the MSVC2017 release doesn't work.

  • @kitfox beyond deploying those .dll files you mentioned, perhaps you also need to set the PATH properly for (system) files already deployed in the machines that somehow are not being found.

    Dependency Walker tool is your friend in cases like this.

    I cannot speak regarding MSVC sorry

  • @Pablo-J.-Rogina Looks like I need to add libstdc++-6.dll to my deploy directory as well. Seems odd the windeployqt tool would skip these. It would be nice if I could get this working for MSVC as well.

  • Lifetime Qt Champion

    I noticed a few times thats the compilers runtime dlls are not added.
    For mingw its libgcc_s_dw2-1.dll and libwinpthread-1.dll and libstdc++-6.dll

    Often the visual studio run times DLLS are included in Windows, but for Windows 7
    seems not to default have them and one can install
    Microsoft Visual C++ 2017(5) Redistributable to get them

Log in to reply