圖書示例

一個簡單的例子來建立一個庫(而不是一個可執行檔案,這是預設的)。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