如何将Qt编译为静态

编程入门 行业动态 更新时间:2024-10-26 17:30:48
本文介绍了如何将Qt编译为静态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我目前正在Qt中编写代码。如何静态地编译代码?

I am currently writing code in Qt. How to compile the code statically?

从Qt文档中我知道以下步骤

From Qt document I came to know the following step

1)可视化Studio 2008-> commandPrompt-> QtDir-> configure -static-> nmake

1) Visual Studio 2008 -> commandPrompt -> QtDir -> configure -static -> nmake

但是,它占用了17 GB,最后在完成之前退出,并指出空间不够。

But, it took 17 GB and at the end it exited before the completion stating that "the space is not enough".

有没有简单的方法可以将Qt应用程序编译为独立程序?

Is there any simple way to compile the Qt application as a stand alone program?

推荐答案

您已经使用了唯一可行的方法:将源代码编译为静态。

You have already used the only way possible: compiling the source as static.

某些方面的影响很大磁盘大小(这里似乎是问题),并带有相应的配置参数:

Some things that have a very large impact on disk size (which seems to be the problem here), with corresponding configure arguments:

  • 禁用调试:-发布
  • 禁用不需要的模块,尤其是QtWebKit: -no-webkit -no-script -no-scripttools -no -qt3support -nomake演示-nomake工具-nomake示例
  • 禁用LTCG支持,它具有令人讨厌的一面生成大型静态库的效果: no-ltcg
  • Disable debug: -release
  • Disable modules you don't need, especially QtWebKit: -no-webkit -no-script -no-scripttools -no-qt3support -nomake demos -nomake tools -nomake examples
  • Disable LTCG support, which has the nasty side effect of generating huge static libraries: no-ltcg
  • 这些应该有助于保持构建大小最小。

    These should help keep the build size to a minimum.

    更多推荐

    如何将Qt编译为静态

    本文发布于:2023-10-19 19:14:52,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1508500.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:如何将   静态   译为   Qt

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!