我使用 Qt Creator 10.0.1 和 Qt 6.5.1 版本。我从维护工具安装了QtSerialPort版本6.5.2。
我已将 QT += 串行端口添加到我的 .pro 文件中,但从中收到“未知模块”错误。
我是否必须下载 QtSerialPort 版本 6.5.1 或者是否缺少一些步骤?我预计如果我有 6.5 版本中的任何一个,QT += 串行端口都可以工作。
QT += core gui
QT += serialport
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
CONFIG += c++17
# 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
QMAKE_CXXFLAGS += -Wa,-mbig-obj # This line is for QCustomPlot to work
SOURCES += \
main.cpp \
mainwindow.cpp \
qcustomplot.cpp
HEADERS += \
mainwindow.h \
qcustomplot.h
FORMS += \
mainwindow.ui
RESOURCES += \
resources.qrc
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
如果您针对版本 6.5.1 进行构建,则需要此版本中的模块。我会将整个项目切换到最新版本,即 6.5.3。