How to build Qt5 app with their static libs?

穿精又带淫゛_ 提交于 2019-12-08 12:42:07

问题


I'm a Qt beginner and I want to know how to build Qt5 apps with their static libraries. Is that possible to build with static libs everything that can be build with dll's ?. I want to know because I don't want to install Qt libs everywhere where I want my apps to be running. For example I want to build with static libs app which code is in this post:

Widgets must be created in the GUI thread Error !. How to correct the code?

Is that possible ? How to do that ?


回答1:


In order to use Qt as a static library, you have to rebuild Qt itself. You can find a guide here

It recommends rebuilding Qt as following:

cd C:\path\to\Qt
configure -static <any other options you need>
nmake sub-src

Make sure you've embedded all plugins you need. (see configure options)

However, not all Qt parts can be built as a static libraries. As far as I know, you may expose some difficulties with Webkit.

After rebuilding Qt, you can build your apps, as usual.

Note also, that Qt is licensed under LGPL or GPL or commercial licence. Using static version of Qt can impose some limitations on your app distributions.



来源:https://stackoverflow.com/questions/16490032/how-to-build-qt5-app-with-their-static-libs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!