Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to include <QSerialPort> correctly?
QtWS25 Last Chance

How to include <QSerialPort> correctly?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qserialport
6 Posts 4 Posters 5.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BurSer
    wrote on 4 Feb 2021, 16:13 last edited by
    #1

    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).

    K 1 Reply Last reply 4 Feb 2021, 16:25
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 4 Feb 2021, 16:23 last edited by
      #2

      Hi
      Thats a bit odd as its normally just
      QT += serialport
      As far as I know, that module is not optional and always installed.

      Are the examples there ?
      alt text

      1 Reply Last reply
      2
      • B BurSer
        4 Feb 2021, 16:13

        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).

        K Offline
        K Offline
        KroMignon
        wrote on 4 Feb 2021, 16:25 last edited by KroMignon 2 Apr 2021, 16:36
        #3

        @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 be QT += serialport
        My bad CONFIG += 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

        It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

        M B 2 Replies Last reply 4 Feb 2021, 16:31
        4
        • K KroMignon
          4 Feb 2021, 16:25

          @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 be QT += serialport
          My bad CONFIG += 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

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 4 Feb 2021, 16:31 last edited by
          #4

          @KroMignon

          ahh ofc. Its Qt6 :)
          Good catch !

          1 Reply Last reply
          0
          • K KroMignon
            4 Feb 2021, 16:25

            @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 be QT += serialport
            My bad CONFIG += 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

            B Offline
            B Offline
            BurSer
            wrote on 5 Feb 2021, 13:15 last edited by
            #5

            @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.)

            P 1 Reply Last reply 5 Feb 2021, 19:56
            0
            • B BurSer
              5 Feb 2021, 13:15

              @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.)

              P Offline
              P Offline
              Pablo J. Rogina
              wrote on 5 Feb 2021, 19:56 last edited by
              #6

              @BurSer if your issue is solved please don't forget to mark your post as such!

              Upvote the answer(s) that helped you solve the issue
              Use "Topic Tools" button to mark your post as Solved
              Add screenshots via postimage.org
              Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

              1 Reply Last reply
              2

              1/6

              4 Feb 2021, 16:13

              • Login

              • Login or register to search.
              1 out of 6
              • First post
                1/6
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved