How to run a Qt Program without Qt itself being in

2019-03-20 14:20发布

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:

  • 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

Now I want to run that program on a machine that has no Qt installed. How do I do that? It shouldn't be necessary for users to install an IDE just to use a program, right?

Details of the development machine where it works:

  • Windows 8
  • Qt 5.3.1

The deploying platform is:

  • Windows Vista
  • No Qt installed but all necessary .dlls are in place

Errors I get are first:

This application failed to start because it could not find or load the Qt platform plugin "windows". Reinstalling the application may fix this problem.

Next error message is:

This application requested the Runtime to terminate in an unusual way. Please contact support.

Then the program crashes. But if I install Qt5.3.1 it works. So it has something to do with files in the c:/Qt directory

8条回答
We Are One
2楼-- · 2019-03-20 15:10

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
查看更多
【Aperson】
3楼-- · 2019-03-20 15:18

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.

查看更多
登录 后发表回答