简体   繁体   中英

Static libraries in Qt 5.14 MinGW toolchain? (default Qt installation)

Just now I noted that the MinGW Toolchain that comes with the default Qt installation, at least Qt 5.14, comes with a lib directory with libQt5*.a files. Are those files static libraries?

I think so because:

  1. They have a size similar to the ones that I get when I compile Qt statically for release.
  2. $file./libQt5Core.a outputs ./libQt5Core.a: current ar archive , which is the same that it outputs for the statically compiled ones.

If indeed they're static libraries, how can I tell QMake (for example editing the .pro file) to link to those instead of linking to the shared ones?

Qt 静态库的 Windows 屏幕截图

Are those files static libraries?

No. They are not static. Qt's default online installer provides only shared libraries. That *.a files are so-called import libraries.

Import library is an.a or.lib library, but it only contains bit of information needed to tell the linker/OS how your program interacts with the dll's.

If you need Qt static windows build for some reasons, you have some options:

  • HARD Build whole Qt (or needed modules) byyourself .

  • EASY Use vcpkg : vcpkg install qt5:x64-windows-static

With vcpkg you can create custom MinGW triplet if you need MinGW for some reason. But I suggest you stick with MSVC.

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