qt - Qt Creator 中的串口模块

标签 qt libraries qt6

我正在使用 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/

相关文章:

javascript - React SDK可以在纯JavaScript中使用吗?

Angular 6 : Changing the code of an external library only works with 'ng serve' and not with 'ng build'

qml - 你怎么能在 QML JavaScript 中沮丧呢?

c++ - 在 Qt6 中移植 QRegExp::exactMatch()

c++ - 如何在 C++ 中获取 Linux 上当前聚焦窗口的几何图形?

c++ - 在 QTCreator Undefined Reference 中使用库

visual-studio - 如何将常规的 win32 (VC++ vcproj) 项目转换为 Qt 项目?

具有多个离线 map 的 iOS 导航应用程序 : which library to use?

linux - Linux 上 Qt6 的 Bazel 规则 : How to copy required libs?

windows - Win7 64位安装Qwt