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:
$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?
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) by yourself.
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.