Important: Please read the Qt Code of Conduct -

Deploying Qt app in Windows

  • Hi!
    Sometime ago I created a Windows installer for my Qt app. It works perfectly but currently it requires a short .bat file to launch the software. This is the content of that file:

    @echo OFF
    set PATH=%QTAPP_HOME%\bin\raw;%QTAPP_HOME%\lib;%QTAPP%\lib\ssl;%QTAPP_HOME%\lib\qt5;%QTAPP_HOME%\lib\libav
    start qtapp.exe %1

    Trying to avoid the use of the .bat file, I tried to set the PATH variable from the main.cpp directly with no luck. I tried creating a qt.conf but it failed too. Now I ran out of ideas.
    Any time I execute the qtapp.exe binary I got an error saying that the program either can't find some plugin dll's or 3rd party libraries. Nevertheless, the .bat file works like a charm.

    This is the current tree structure of my app:

    • appDir
      • qtapp.bat
      • bin/
        • qtapp.exe
      • lib
        • qt5
        • libav
        • ssl
      • plugins
      • data

    I really appreciate any hint about how to enable the qtapp.exe binary to run directly. Thanks!

  • IIRC, you either have to run it thru the batch file, or add the needed path components to the default PATH variable of your domain profile under windows.

  • Qt Champions 2019

    Why don't you simply use a default directory structure as described here and use windeployqt to copy all needed files?

  • @Christian-Ehrlicher I tried to do it, but the only way it seems to work is by putting all the project files in the same folder. My project has more than 50 files among libraries, plugins, and data. I think there must be a more elegant way of releasing a Qt app, isn't it?

  • Qt Champions 2019

    Not for the dlls - but it's up to you where to put your own dlls and data. Fiddling around with some batch files is crying for problems.

Log in to reply