Qt 创建可执行文件

发布于 2024-07-16 14:58:41 字数 232 浏览 2 评论 0原文

有没有一种快速、直接的方法将 Qt 应用程序变成可执行文件? 我尝试按照 http://doc.qt.digia.com 上的说明进行操作/4.1/deployment-windows.html 但到目前为止尚未成功; 我无法提供任何帮助,将不胜感激。 谢谢!

Is there a quick, straightforward way to make a Qt application into an executable? I attempted to follow the instructions at http://doc.qt.digia.com/4.1/deployment-windows.html but have been unsuccesfull thus far; I'm unable to Any help would be much appreciated. Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

因为看清所以看轻 2024-07-23 14:58:41

我总是使用 CMake 来构建 Qt 项目,它简单、免费且跨平台。 指南:使用 CMake 编译 Qt4 应用。 CMake 还附带 CPack,可以轻松制作 Windows、Mac 和 Linux 的安装程序。

我同意 chmod700 关于 Qt Creator 的建议,它不是我最喜欢的 IDE,但它仍然非常好且简单。

I always use CMake to build Qt projects, it's easy, free and cross platform. Guide : Compiling Qt4 apps with CMake. CMake also come with CPack to easly make installer for Windows, Mac and Linux.

I agree with chmod700 about the Qt Creator suggestion, it's not my favorite IDE but it's still really nice and easy.

呆橘 2024-07-23 14:58:41

你的意思是安装包吗? 我假设您能够编译、链接和运行您的应用程序,并且您的意思是如何为其他人打包它。

http://installbuilder.bitrock.com/ <-- 基于 Qt 的项目的特殊处理,但成本 $
http://www.jrsoftware.org/isinfo.php <-- 我个人的最爱而且它是免费的(虽然学习高级功能可能很困难)

但是如果您的意思是如何构建您的应用程序,您可能想尝试新的 Qt Creator (http://www.qtsoftware.com/products/appdev/developer-tools/developer-tools#qt- tools-at-a),它将为您设置构建目标,并真正使桌面 Qt 开发变得轻而易举。 此外,如果您仍在使用 4.1,您现在可以在所有平台上根据 LGPL 使用 4.5,这使得升级几乎是理所当然的。

Do you mean an installer package? I assume you are able to compile, link, and run your app and you mean how do you package it up for others.

http://installbuilder.bitrock.com/ <-- special handling of Qt based projects but costs $
http://www.jrsoftware.org/isinfo.php <-- my personal favorite and it's free (can be rough to learn advanced features though)

Though if you mean how do you build your app, you may want to try the new Qt Creator (http://www.qtsoftware.com/products/appdev/developer-tools/developer-tools#qt-tools-at-a) which will setup build targets for you and really makes desktop Qt dev a snap. Also if you're still using 4.1, you can now use 4.5 under the LGPL on all platforms making it almost a no-brainer to upgrade.

从此见与不见 2024-07-23 14:58:41

我不确定我是否理解你的问题。 假设您正在使用 MinGW,这非常简单:

  • 获取 Qt 源并将其解压到某个文件夹(fe c:\Qt\4.5.0-static),然后
  • 安装 MinGW。 确保 MinGW 可执行文件夹位于 %PATH% 变量中。
  • 打开 cmd 窗口,转到 Qt 源并运行 configure -static。 如果您愿意,您可以添加其他配置选项,但通常您不需要这样做。
  • 构建 Qt 完成后,转到应用程序源,打开 cmd 窗口并运行构建的 Qt 安装的 qmake - 即 c:\Qt\4.5.0-static\bin\qmake 中上面给出的例子。
  • 运行 make
  • 你最终会得到一个静态链接的二进制文件(你可能想用 Dependency 检查它沃克)。

使用 Visual Studio 执行相同的操作非常相似。

或者您想动态构建并创建安装程序包?

I'm not sure if I understand your problem. Assuming you're using MinGW, it's really easy and quite straightforward:

  • get the Qt sources and unpack them to some folder (f.e. c:\Qt\4.5.0-static)
  • install MinGW. Make sure the MinGW executable folder is in the %PATH% variable.
  • open a cmd windows, go to the Qt sources and run configure -static. You can add other config options if you like to, but usually you don't need that.
  • when building Qt finished, go to your application sources, open a cmd window and run the qmake of your built Qt installation -- i.e. c:\Qt\4.5.0-static\bin\qmake in the example given above.
  • run make
  • you get a statically linked binary in the end (you might want to check it with Dependency Walker).

Doing the same using Visual Studio is pretty similar.

Or do you want to build dynamically and create an installer package?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文