一.准备
1.准备好xxx.lib和xxx.h文件
二.编程
1.新建一个qt的console application工程
按照默认操作,一路next即可
此时.pro文件中的内容如下,贴出这个内容是为了和添加lib后做一个对比:
QT -= gui
CONFIG += c++11 console
CONFIG -= app_bundle
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
2.将xxx.lib和xxx.h文件添加到工程中,以方便使用
2.1.右击项目名称,选择"添加库...",弹出下图界面,选择外部库: