I'm having a hell of a time finding documentation which clearly explains how to use a static library in Qt Creator.
I've created and compiled my static library using Qt Creator (New=>Projects\C++ Library=>Set type to "Statically Linked Library"). It compiles and spits out a ".a file".
The problem I encounter is when I try to use the library. I have another project that would like to use it (#include files in the library, etc) but I don't know the proper way to link with the library or include files from the library.
Qt uses dynamic linking by default. You'll notice this immediately during deployment to a non-developer machine, because your code will not run without the Qt libraries. If your concern is the LGPL, just be careful when compiling Qt itself.
Qt Creator is a cross-platform integrated development environment (IDE) built for the maximum developer experience. Qt Creator runs on Windows, Linux, and macOS desktop operating systems and allows developers to create software across desktop, mobile, and embedded platforms.
LIBS += -L[path to lib] -l[name of lib]
Note! that filename of lib: lib[nameOfLib].a and you have to pass only original part -l[nameOfLib]
..from QT project creator
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With