Run .EXE without Qt

后端 未结 3 1773
伪装坚强ぢ
伪装坚强ぢ 2020-12-30 13:43

[ Solution ]

I want to run my app created with QtSDK on a machine that does not have Qt installed.

I tried to copy

3条回答
  •  没有蜡笔的小新
    2020-12-30 14:13

    To distribute your application you need to copy the DLLs (only the DLLs necessary).

    1. Copy the DLLs necessary from :\Qt\Qt\\mingw\ or :\Qt\Qt\\mingw\bin\

      eg.: C:\Qt\Qt5.2.0\5.2.0\mingw48_32\ or C:\Qt\Qt5.2.0\5.2.0\mingw48_32\bin

    2. Paste the folder of your application.

    3. Then copy the folders inside of :\Qt\Qt\\mingw\plugins

      eg.: C:\Qt\Qt5.2.0\5.2.0\mingw48_32\plugins

    4. Paste the folders of your application.

    Note: In this example (below), it was necessary to copy DLLs from different places and remove the Debug DLLs (used only to compile in Debug).

    Note that the debug dlls end with "d.dll", for example: Qt5Core.dll and Qt5Cored.dll or Qt5Concurrent.dll and Qt5Concurrentd.dll, the ending with "d.dll" should not be copied.

    The structure should look something like this (example):

    • c:\project\app.exe (your app created in Qt)
    • c:\project\Qt5Core.dll (dll from qt/mingw folder or qt/mingw/bin)
    • c:\project\platforms (folder from qt/mingw/plugins folder)
    • c:\project\platforms\qminimal.dll (dll from qt/mingw/plugins/platforms folder)

    Only some DLLs the mingw will be needed, so I recommend using the Dependency Walker 2.2

    The result should look like this (not all dlls are needed, this can vary by project type): app folder


    Thanks to:

    • +1 for @MartinBeckett, showed me the program to find the DLLs required.

    • +1 for @WouterHuysentruit, thanks to the application I indicated, I discovered that the contents of the mingw\plugins folder should go straight into the application folder.

    • @WouterHuysentruit I would consider your answer as correct, but you just said, so I put a simpler explanation. Thanks anyway.

提交回复
热议问题