How to run a Qt Program without Qt itself being installed?

后端 未结 8 954
广开言路
广开言路 2021-02-09 07:00

I have written a program with Qt5.3.1 and run it on my development machine where it works fine. I copied all necessary .dll files into the folder where my .exe is. These are:<

相关标签:
8条回答
  • 2021-02-09 07:04

    if Qt dlls are there, they it should work. My guess is that you are missing the run time libraries/dlls of your IDE. For example, if you are using Visual Studio 2010 as your IDE, then you need to install VS2010 Redistributable x86/x64 link depends on your architecture.

    0 讨论(0)
  • 2021-02-09 07:10

    This application failed to start because it could not find or load the Qt platform plugin "windows".

    For this problem, you should copy the plugin {QTSDK}/plugins/platforms/qwindows.dll to {YOUR_EXE_DIR}/platforms/qwindows.dll.

    0 讨论(0)
  • 2021-02-09 07:12

    A better solution is to use the Qt SDK application "windeployqt". It is used to copy all the required dlls and plugins to your application folder based on target platform. You can then run that on another computer. Here is the documentation: https://doc.qt.io/Qt-5/windows-deployment.html.

    For example, if your executable was built using mingw53_32 and your executable is in "C:\example_qtapp":

    QT_INSTALL_DIR\minqw53_32\bin\windeployqt.exe c:\example_qtapp
    
    0 讨论(0)
  • 2021-02-09 07:17

    I have encountered this problem as well,

    In your Qt Directory, with the proper Qt version C:\Qt\Qt5.2.1\5.2.1\mingw48_32\plugins\platforms\

    copy qwindows.dll into a new folder that lives next to your executable, such that your list would be

    • Qt5Widgets.dll
    • Qt5Network.dll
    • Qt5Gui.dll
    • Qt5Core.dll
    • icudt51.dll
    • icuin51.dll
    • icuuc51.dll
    • libgcc_s_dw2-1.dll
    • libwinpthread-1.dll
    • libstdc++-6.dll
    • platforms/qwindows.dll
    0 讨论(0)
  • 2021-02-09 07:23

    You should place Qt DLLs along the release version of your executable. These are Qt5Core.dll, Qt5Gui.dll and possibly the ones for other modules that you have used. These dll files are in your installed Qt Directory in bin folder. You should also place LIBGCC_S_DW2-1.DLL, MINGWM10.DLL and LIBSTDC++-6.dll in case you are using MinGW.

    If you are using plugins you should place their dll in a folder named plugins beside your exe. In case of using icons and images you should ship their dlls like qico.dll and qsvg.dll in a folder named imageformats.

    0 讨论(0)
  • 2021-02-09 07:27

    The short answer is you either need to do a static build, or you need to redistribute the Qt shared library DLLs. If you're looking for a smaller file size static builds are often better, but there may be legal implications with this approach if you're using Qt5 under a LGPL license. I'm not a lawyer, but you can read about LGPL linking rules in LGPL section 4.1.

    The long answer is you should read the general Qt5 deployment guide and the Qt5 for Windows deployment guide. These go into quite a bit of detail.

    0 讨论(0)
提交回复
热议问题