Qt Library example


Example

A simple example to make a library (rather than an executable, which is the default). TEMPLATE variable specifies type of the project you are making. lib option allows makefile to build a library.

library.pro

HEADERS += library.h
SOURCES += library.cpp

TEMPLATE = lib

# By default, qmake will make a shared library.  Uncomment to make the library 
# static.
# CONFIG += staticlib

# By default, TARGET is the same as the directory, so it will make 
# liblibrary.so or liblibrary.a (in linux).  Uncomment to override.
# TARGET = target

When you are building a library, you can add options dll (default), staticlib or plugin to CONFIG.