简体   繁体   中英

How to build Qt5 app with their static libs?

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 ?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM