Qt中的独立exe [英] standalone exe in Qt

查看:158
本文介绍了Qt中的独立exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Qt msvc 2010 5中制作一个独立的.exe文件.我将模式更改为"release"并构建我的项目,然后将release/debug文件夹中的.exe文件复制到Qt目录中的bin目录中,然后我复制所有bin文件夹.它可以在我的计算机上正常工作,但是当我将bin文件夹移动到其他计算机时,.exe文件不起作用.我在另一台计算机上安装了Visual c ++ 2010可再发行组件包,但仍然无法正常工作.我该怎么办?

I want to make a standalone .exe file in Qt msvc 2010 5. I change the mode to "release" and build my project and I copy the .exe file in release/debug folder to bin directory in Qt directory and then I copy all the bin folder. it works properly in my computer, but when I move the bin folder to other computers the .exe file doesn't work. I installed visual c++ 2010 redistributable package in the other computer but still it doesn't work. what should I do?

推荐答案

答案很可能是另一台计算机未安装Qt.如果要在Windows上使用完全独立的Qt应用程序(静态链接),请查看以下内容: http://qt- project.org/wiki/Build_Standalone_Qt_Application_for_Windows

The answer is most likely that the other machine doesn't have Qt installed. If you want a wholly standalone Qt app on Windows (statically linked), check this out: http://qt-project.org/wiki/Build_Standalone_Qt_Application_for_Windows

一些快速构建说明-

  1. 确保已安装python并在路径中获取Qt 源代码 ( http://download.qt-project.org/official_releases/qt/5.1/5.1.1/single/qt-everywhere-opensource-src-5.1.1.zip )
  2. 解压缩该zip文件并在其中打开Visual Studio命令提示符 目录
  3. 执行configure -static -release -no-audio-backend -opengl desktop -opensource -confirm-license
  4. 执行nmake(这将编译所有Qt,并需要一些时间,具体取决于您的处理能力)
  5. 从qt的构建中将CONFIG + = static添加到您的.pro文件调用qmake 刚完成,然后在您的项目上运行nmake.然后,您将获得一个 静态链接的二进制文件.您会知道,因为即使很小 程序的大小将> 5MB.
  1. Make sure you have python installed and in your path Get the Qt source code (http://download.qt-project.org/official_releases/qt/5.1/5.1.1/single/qt-everywhere-opensource-src-5.1.1.zip)
  2. unzip the zip file and open a Visual Studio command prompt in that directory
  3. execute configure -static -release -no-audio-backend -opengl desktop -opensource -confirm-license
  4. execute nmake (this will compile all of Qt and will take a while depending on your processing power)
  5. add CONFIG+=static to your .pro file call qmake from the build of qt you just made and then run nmake on your project. You'll then get a statically linked binary. You'll know because even a very small program will be > 5MB in size.

这篇关于Qt中的独立exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆