1.采用release模式编译程序
2.关掉qt-creator,打开realease文件目录下的exe程序,对话框提示说缺什么dll, 就到 x:\Qt\5.0.2\mingw47_32\bin 里面复制什么dll
(或者用微软的Dependency Walker查看该exe文件需要哪些dll)
3.dll都复制好后, 运行exe还是报了一个 "Visual C++ Rumtime Library : this application has requested the Runtime to terminate it in an unusual way "错误 ,(如果qt-creator没有关就不会报这个错,但是要发布独立程序的话不可能让用户自己安装一个qt-creator的),最后网上查了资料,发现解决这个问题很简单,在release中建立文件夹platforms, 把Qt\Qt5.0.2\5.0.2\mingw47_32\plugins\platforms中的qminimal.dll和qwindows.dll拷贝到其中.
强力推荐参考这篇文章:
QT5 第二章、windows下Qt5.0.2-Helloworld发布 http://blog.csdn.net/lxhjh/article/details/8825747