Qt静态链接和部署 [英] Qt static linking and deployment

查看:175
本文介绍了Qt静态链接和部署的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试部署(发布给公众)一个我最近做的一个简单的qt应用程序,但被困在静态链接qt libs。

I am trying to deploy(release to public) a simple qt application I made recently, but got stuck at static linking qt libs.

我遵循指南qt docs重新构建qt和我的应用程序静态。但是发布版本还是要求qtgui / qtcore dll没有明显的原因,我不知道有没有人看过这样的问题吗?或者甚至更好,已经成功解决了?

I followed the guide on qt docs to re-build qt and my app statically. But the release build still require qtgui / qtcore dll for no apparent reasons, I wonder if anyone has seen this kind of problems before ? Or even better, has successfully resolved it ?

http://doc.qtsoftware.com/4.5/deployment-windows.html

推荐答案

我撰写了静态链接指南


如何使用多个编译器构建Qt静态并保持较小

(因为它可以变得相当大,特别是对于简单的程序)。
您可能还想查看BitRock安装程序,这对于开源项目是免费的。

(because it can get pretty big, especially for simple programs). You may also want to check out the BitRock installer, which is free for open source projects.

简而言之,原来是一点点复杂如果您使用任何Qt认为是插件,例如支持大多数图像类型(JPEG,GIF)或数据库。
例如,如果要包括对图标的Oracle DBMS和GIF图像的支持,则将以下内容添加到.PRO文件中:

In short, it turns out to be a little more complex if you are using anything Qt thinks of as a plugin, such as support for most image types (JPEG, GIF) or databases. For example, if you want to include support for Oracle DBMS and GIF images for your icons, you add the following to your .PRO file:

QTPLUGIN += qsqloci qgif
CONFIG += static

你然后需要:

#include <QtPlugin>

,并导入所使用的任何插件。您需要重新修改这些设置以使其再次使用动态链接进行编译(如调试或添加功能时),尽管这可以轻松自动化。建立与静态链接一起使用的Qt库时,还有一些考虑,尽管Qt指令至少让您开始。

in your project, and import any plugins used. You need to change these settings back order to get it to compile with dynamic linking again (like when debugging or adding features), though this can be easily automated. There are also considerations when building the Qt libraries for use with static linking, though the Qt instructions will at least get you started.

这篇关于Qt静态链接和部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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