首页 > 解决方案 > 将 QML 应用程序与 Qt5 (5.13.2) 静态链接

问题描述

我在 Linux 上使用以下行编译了 Qt 5.13.2:

/home/Qt/5.13.2/Src/configure -release -static -ltcg -optimize-size -opensource -confirm-license -platform linux-g++ -no-pch -nomake tools -nomake tests -nomake examples -skip webengine -prefix "/home/Qt/513-static"

然后我在 QtCreator 中创建了一个新工具包来使用这个编译。编译后,我试图运行,但我得到了错误

This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: wayland-egl, wayland.

我的应用程序适用于动态链接。我应该更改 .pro 文件中的某些内容以使其与静态库一起使用吗?

我试图查看官方文档,但有关此信息的信息很差。

标签: c++qtstaticqml

解决方案


问题出在编译上。我使用以下行编译并且它有效:

configure -release -static -optimize-size -opensource -confirm-license -feature-freetype -fontconfig -c++std c++2a -no-pch -nomake tools -nomake tests -nomake examples -skip webengine -recheck-all -platform linux-g++ -ltcg -xcb -prefix "/home/vinicius/Qt/Qt-static"

推荐阅读