Mitcoc
Mitcoc

Reputation: 31

Qt - How to copy the Qt runtime DLLs to the output path

I need to copy the Qt runtime DLLs libraries to the output path when building. I did a lot of search , I found a lot of topics but none of them helped.

Upvotes: 0

Views: 1835

Answers (2)

Nejat
Nejat

Reputation: 32635

The most convenient way is to use The Windows Deployment Tool to deploy your application. The Windows Deployment Tool could be found in QTDIR/bin/windeployqt.exe. It automatically puts all necessary dll files in your application directory.

Open your command prompt and add the path to your Qt directory and it's bin folder to the PATH variable like :

set PATH= path\to\Qt\bin

Next run the windows deployment tool with your application path as the argument:

windeployqt.exe  <path-to-app-binary>

This way you make sure that the deployed application would work on any computer and you have included whatever necessary.

Upvotes: 6

techneaz
techneaz

Reputation: 1028

  1. Compile your project in release mode

  2. Find the required libraries to run your application

    For a standard installation of Qt, the libraries can be found in

    [Qt Installation Dir][Folder name with the Qt Version][Folder name with compiler type]\bin

    Example: Qt 5.3 installed in C:/Qt and mingw4.8.2 32 bit comiplier, the .dll files will be in the directory:

    C:\Qt\5.3\mingw482_32\bin

  3. To find out which libraries you need, either you can run the application outside Qt Creator (the missing .dll files will be shown in the error message pop up) or you can use a program called dependency walker.

  4. Copy these .dll files to your release folder where you have the .exe of your application Example: Qt5Core.dll ,Qt5Gui.dll etc.

Once you have all the required .dll files you can run your application outside Qt Creator.

Upvotes: 1

Related Questions