如何编译一个包含所有 Qt 所需库、QtCreator、Linux 的项目?

发布于 2024-10-04 05:07:51 字数 289 浏览 0 评论 0原文

首先,我对我的英语感到抱歉。那不是我的语言。

我正在 Linux QtCreator 中开发一个应用程序。当 IDE 询问我将使用的库时,我只是保留选定的库(它们无法取消选中)。现在,我必须在 RedHat 5 中运行编译后的文件,但它没有运行。它告诉“加载共享库时出错:libQtGui.so.4:...”。那么,我该如何解决这个问题呢?

我不应该在 RedHat 中安装 Qt 库(它是一个服务器)。我更喜欢编译 Qt 项目,包括所需的 Qt 库(到自编译文件中,或在同一目录中)。

请问,你能告诉我一些想法吗?

First, I am sorry about my English. That's not my language.

I am developing an application in QtCreator, Linux. When the IDE asked me about the libraries I would use, I just leave the selected ones (they was not enabled for unchecking). Now, I have to run the compiled file in RedHat 5, but it doesn't run. It tells "Error while loading shared libraries: libQtGui.so.4: ...". So, how do I fix this problem?

I should not install Qt libraries in RedHat (it's a server). I prefer to compile the Qt project including needed Qt libraries (into self compiled file, or in the same directory).

Please, can you tell me some idea??

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

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

发布评论

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

评论(1

喜爱皱眉﹌ 2024-10-11 05:07:52

如果您无法安装 qt,您有两个主要替代方案:

  1. 将库与应用程序一起部署(如何执行此操作取决于部署应用程序的方式。手动复制可能就足够了。)
  2. 静态链接 qt 库。然后它们将包含在您的可执行文件中(因此会更大)。 静态链接

静态链接与动态链接的一些优缺点在 此线程

If you cannot install qt you have two main alternatives:

  1. Deploy the libraries together with your application (how you do this depends on the way you deploy your application. It may suffice to do a manual copy.)
  2. Statically link with the qt libraries. They will then be included in your executable (which will be much larger as a result). Static linking

Some pros and cons of static vs dynamic linking are discussed in this thread.

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