图书示例

一个简单的例子来创建一个库(而不是一个可执行文件,这是默认的)。TEMPLATE 变量指定你正在进行的项目的类型。lib 选项允许 makefile 构建库。

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

在构建库时,可以将选项 dll(默认值),staticlibplugin 添加到 CONFIG