How to include <QSerialPort> correctly?
-
wrote on 4 Feb 2021, 16:13 last edited by
I'm trying to include QSerialPort in a project. In the .pro file I've written this:
QT += core gui network greaterThan(QT_MAJOR_VERSION, 4) { QT += widgets serialport } else { CONFIG += serialport } CONFIG += c++11 ...
and so on.
After trying to build (or clean-qmake-rebuild) I get the message "Project ERROR: Unknown module(s) in QT: serialport".
I've also tried to find the file QSerialPort or QtSerialPort in the folder with all the Qt and there's no such file.
System: Windows 10, Qt Creator 4.14.0 based on Qt 5.15.2, MinGW... (don't remember the version but I've downloaded it today).
-
-
I'm trying to include QSerialPort in a project. In the .pro file I've written this:
QT += core gui network greaterThan(QT_MAJOR_VERSION, 4) { QT += widgets serialport } else { CONFIG += serialport } CONFIG += c++11 ...
and so on.
After trying to build (or clean-qmake-rebuild) I get the message "Project ERROR: Unknown module(s) in QT: serialport".
I've also tried to find the file QSerialPort or QtSerialPort in the folder with all the Qt and there's no such file.
System: Windows 10, Qt Creator 4.14.0 based on Qt 5.15.2, MinGW... (don't remember the version but I've downloaded it today).
wrote on 4 Feb 2021, 16:25 last edited by KroMignon 2 Apr 2021, 16:36@BurSer said in How to include <QSerialPort> correctly?:
System: Windows 10, Qt Creator 4.14.0 based on Qt 5.15.2, MinGW... (don't remember the version but I've downloaded it today).
INFO: Qt Creator is an IDE, it version is NOT relevant.
Which Qt Kit do you use to build your project (cf. Tools/Options/Kits)?
Edit:
CONFIG += serialport
does not make sense to me, it should beQT += serialport
My badCONFIG += serialport
is for Qt 4.x!!AFAIK,
QSerialPort
is not available with Qt 6.0, you have to use Qt 5.xx or wait until it is ported to Qt 6.x==> https://doc.qt.io/qt-6/whatsnew60.html#removed-modules-in-qt-6-0
-
@BurSer said in How to include <QSerialPort> correctly?:
System: Windows 10, Qt Creator 4.14.0 based on Qt 5.15.2, MinGW... (don't remember the version but I've downloaded it today).
INFO: Qt Creator is an IDE, it version is NOT relevant.
Which Qt Kit do you use to build your project (cf. Tools/Options/Kits)?
Edit:
CONFIG += serialport
does not make sense to me, it should beQT += serialport
My badCONFIG += serialport
is for Qt 4.x!!AFAIK,
QSerialPort
is not available with Qt 6.0, you have to use Qt 5.xx or wait until it is ported to Qt 6.x==> https://doc.qt.io/qt-6/whatsnew60.html#removed-modules-in-qt-6-0
ahh ofc. Its Qt6 :)
Good catch ! -
@BurSer said in How to include <QSerialPort> correctly?:
System: Windows 10, Qt Creator 4.14.0 based on Qt 5.15.2, MinGW... (don't remember the version but I've downloaded it today).
INFO: Qt Creator is an IDE, it version is NOT relevant.
Which Qt Kit do you use to build your project (cf. Tools/Options/Kits)?
Edit:
CONFIG += serialport
does not make sense to me, it should beQT += serialport
My badCONFIG += serialport
is for Qt 4.x!!AFAIK,
QSerialPort
is not available with Qt 6.0, you have to use Qt 5.xx or wait until it is ported to Qt 6.x==> https://doc.qt.io/qt-6/whatsnew60.html#removed-modules-in-qt-6-0
wrote on 5 Feb 2021, 13:15 last edited by@KroMignon Thanks! The problem was in Qt 6. After changing it to the last subversion of Qt 5 everything has been compiled. (At least, Qt Creator isn't angry about the .pro file.)
-
@KroMignon Thanks! The problem was in Qt 6. After changing it to the last subversion of Qt 5 everything has been compiled. (At least, Qt Creator isn't angry about the .pro file.)
wrote on 5 Feb 2021, 19:56 last edited by@BurSer if your issue is solved please don't forget to mark your post as such!
1/6