Qt5 中发布程序遇到could not find or load the Qt platform plugin "windows"
2014-06-26 16:06
741 查看
~~~~我的生活,我的点点滴滴!!
转至http://www.cnblogs.com/mmix2009/p/3536825.html 图片什么的我也懒得自己截了。
Qt5也出来一段时间了,改变很大,又添加了很多新功能,有了for android for ios for wp等,感觉好高大上啊,这里我们先不说 移动平台的,我们在这里普及一些程序发布时常见错误,在windows上程序发布时我们需要把动态链接库dll全带上,但是当我们带上后,双击exe后,发现报错
一般这种在本机上运行好好的,在别人那里运行不起来,就是缺少dll,而正常的qt的dll,我们只需要去qt的lib下面复制就行,直接与exe放在同目录下就行,但是对于plugin下的,我们要注意了,需要连文件夹一起复制过来,不能直接和exe同级,例如上面问题就是缺少qwindows.dll
这个dll, 这个dll在qt4是没有的,qt5新出的,所以我们进入下面目录去复制
D:\Qt\Qt5.2.0\5.2.0\msvc2010\plugins\platforms\qwindows.dll,带红色的复制到你的exe执行文件目录。就是platforms文件夹,他里面一个qwindows.dll
很多时间也许你复制了他还是不好使用,因为有可能你还使用了其他的插件,大家可以去plugin下看看,好多插件的,我们依次照上面的方法复制文件夹到自己的exe目录下,然后在main中添加代码
QApplication::addLibraryPath("./plugins");
我写的Qt程序只用到了image插件,需要把
D:\Qt\Qt5.2.0\5.2.0\msvc2010\plugins\imageformats,带红色的文件夹包括imageformats里的大部分dll复制到exe执行文件目录就OK了,如果用到数据库插件等,也要复制。
有人说我们怎么知道我们的程序哪些dll是被需要的?我们可以使用vc自带的一个工具Depends 使用他打开exe就能列出所需要的dll,这里我不科普他了,我们用一个新的、功能更强大的工具------>Process
Explorer
Process
Explorer帮助非常大,我们用Qt Creator 运行我们将要发布的程序时,就可以用 Process Explore 查看exe使用的dll了,除了C:windows\system32的我们不需要特别关注外,像下图红框中的就要关注了,程序运行失败很可能就是少了对应的dll文件。
最后我们看看我们发布程序的布局
其实原理和qt4发布程序时一样的。
附上process explorer的下载地址
转至http://www.cnblogs.com/mmix2009/p/3536825.html 图片什么的我也懒得自己截了。
Qt5也出来一段时间了,改变很大,又添加了很多新功能,有了for android for ios for wp等,感觉好高大上啊,这里我们先不说 移动平台的,我们在这里普及一些程序发布时常见错误,在windows上程序发布时我们需要把动态链接库dll全带上,但是当我们带上后,双击exe后,发现报错
一般这种在本机上运行好好的,在别人那里运行不起来,就是缺少dll,而正常的qt的dll,我们只需要去qt的lib下面复制就行,直接与exe放在同目录下就行,但是对于plugin下的,我们要注意了,需要连文件夹一起复制过来,不能直接和exe同级,例如上面问题就是缺少qwindows.dll
这个dll, 这个dll在qt4是没有的,qt5新出的,所以我们进入下面目录去复制
D:\Qt\Qt5.2.0\5.2.0\msvc2010\plugins\platforms\qwindows.dll,带红色的复制到你的exe执行文件目录。就是platforms文件夹,他里面一个qwindows.dll
很多时间也许你复制了他还是不好使用,因为有可能你还使用了其他的插件,大家可以去plugin下看看,好多插件的,我们依次照上面的方法复制文件夹到自己的exe目录下,然后在main中添加代码
QApplication::addLibraryPath("./plugins");
我写的Qt程序只用到了image插件,需要把
D:\Qt\Qt5.2.0\5.2.0\msvc2010\plugins\imageformats,带红色的文件夹包括imageformats里的大部分dll复制到exe执行文件目录就OK了,如果用到数据库插件等,也要复制。
有人说我们怎么知道我们的程序哪些dll是被需要的?我们可以使用vc自带的一个工具Depends 使用他打开exe就能列出所需要的dll,这里我不科普他了,我们用一个新的、功能更强大的工具------>Process
Explorer
Process
Explorer帮助非常大,我们用Qt Creator 运行我们将要发布的程序时,就可以用 Process Explore 查看exe使用的dll了,除了C:windows\system32的我们不需要特别关注外,像下图红框中的就要关注了,程序运行失败很可能就是少了对应的dll文件。
最后我们看看我们发布程序的布局
其实原理和qt4发布程序时一样的。
附上process explorer的下载地址
相关文章推荐
- Qt5 中发布程序遇到could not find or load the Qt platform plugin "windows"
- Qt程序部署时遇到的坑:could not find or load the Qt platform plugin "windows"
- Qt5 中发布程序遇到could not find or load the Qt platform plugin "windows"
- Qt5 中发布程序遇到could not find or load the Qt platform plugin "windows"
- 解决QT5.5.1 could not find or load the Qt platform plugin "windows"
- Qt release之后运行显示it could not find or load the Qt platform plugin "windows".解决方法
- Qt5程序错误:could not find or load the Qt platform plugin "windows"
- 问题解决:it could not find or load the Qt platform plugin "windows"
- it could not find or load the Qt platform plugin "windows"
- "it could not find or load the Qt platform plugin "windows""解决方法
- This application failed to start because it could not find or load the Qt platform plugin "xcb".
- This application failed to start because it could not find or load the Qt platform plugin "xcb".
- This application failed start because it could not find or load the Qt platform plugin "windows in"
- 有关This application failed to start because it could not find or load the Qt platform plugin "windows
- Qt程序运行提示“it could not find or load the QT platform plugin “windows””
- This application failed to start because it could not find or load the Qt platform plugin "windows"
- This application failed to start because it could not find or load the Qt platform plugin "windows"
- This application failed to start because it could not find or load the Qt platform plugin "windows"
- This application failed to start because it could not find or load the Qt platform plugin "xcb".
- 1.定义初始化为false的bool类型、2.qtrelease版本发布时,提示:could not find or load the Qt platform plugin "window"