我正在使用 Qt Creator 创建一个 GUI 应用程序,以与 esp32 通信并控制输出。我目前使用的是 Qt 6.4 版本,我知道 lib 在 6.0 或 6.1 中不可用,但我在 6.4 上找不到任何内容。
本页建议输入QT+=串口; https://doc.qt.io/qt-6/qtserialport-index.html 。在我的 Qt 应用程序 my.pro 文件中,我声明了这一点:
QT += core gui serialport
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = serialRead
TEMPLATE = app
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
SOURCES += \
main.cpp \
mainwindow.cpp
HEADERS += \
mainwindow.h
FORMS += \
mainwindow.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
错误消息:
:-1:错误:项目错误:QT 中的未知模块:串行端口
I still dont know what to do to be able to use the QSerialPort library. I would appreciate any guidance. Thank you!
最佳答案
使用应用程序QT Maintenance Tool添加串口库。
关于qt - Qt Creator 中的串口模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74282591/