QtSerialPort QSerialPort 没有这样的文件或目录

QtSerialPort QSerialPort no such file or directory

本文关键字:文件 QSerialPort QtSerialPort      更新时间:2023-10-16

我使用本教程:http://doc-snapshot.qt-project.org/qt5-stable/qtserialport/blockingmaster.html

但是当我想运行它时,Qt Creator会生成以下错误:

错误:QT 中的未知模块:串行端口

当我将鼠标放在#include <QtSerialPort/QSerialPort>上时,它说:

不包含此类文件或目录

我使用Qt 5.0.1有什么想法吗?

尝试包含#include <QtSerialPort/QSerialPort>而不是
#include <QSerialPort> ,这对我有用

QtSerialPort模块不是Qt 5.0的一部分。它被添加到即将发布的Qt 5.1中。

您正在查看即将发布的Qt 5.1的文档快照。请参阅 http://doc-snapshot.qt-project.org/qt5-stable/qtdoc/index.html。

Qt 5.0的文档在这里:http://qt-project.org/doc/qt-5.0/qtdoc/index.html。

如果你还想尝试QtSerialPort,Qt 5.1的RC1刚刚发布。您可以在此处下载: http://download.qt-project.org/development_releases/qt/5.1/5.1.0-rc1/

尝试包含

#include <QtSerialPort/QSerialPort>

同时更新您的 project.pro 文件,添加此标志

QT += serialport

清理完毕后,Qmake,重建项目