1、需要在头文件 include <QtSerialPort/QSerialPort> include <QtSerialPort/QSerialPortInfo> 2、需要在 .pro 文件中增加如下语句 QT += serialport 3、