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. QT5.2.1 :-1: error: Unknown module(s) in QT: serialport
QtWS25 Last Chance

QT5.2.1 :-1: error: Unknown module(s) in QT: serialport

Scheduled Pinned Locked Moved General and Desktop
11 Posts 7 Posters 53.4k 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.
  • W Offline
    W Offline
    wowy
    wrote on last edited by
    #1

    Hi,
    I am trying to work with serial port communication in a little console application on linux and after some research i saw that the module for serialport is in the basic installation qt5.1 or superior.

    I added :
    '''QT += serialport'''
    to my .pro file and :
    '''#include <QtSerialPort/QtSerialPort>'''
    to my .cpp but it gives me the error :
    '''Unknown module(s) in QT: serialport'''

    I checked in the installation folder of qt5.2.1 and i found files related to this module but it seems qt don't find them. Also, when including <QtSerialPort/QtSerialPort> it don't find it but it seems to be able to find <QtSerialPort/QSerialPortInfo>.

    Do i have to transfert files to my application folder or am i missing a line somewhere in my .pro/.cpp files ?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on last edited by
      #2

      @wowy said:

      #include <QtSerialPort/QtSerialPort>

      Hi,

      I think the right header file is #include <QtSerialPort/QSerialPort>. Probably an error in the Module's page

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      0
      • cybercatalystC Offline
        cybercatalystC Offline
        cybercatalyst
        wrote on last edited by
        #3

        On which OS are you working? Under Ubuntu you have to install the Qt serialport package.

        W 1 Reply Last reply
        1
        • cybercatalystC cybercatalyst

          On which OS are you working? Under Ubuntu you have to install the Qt serialport package.

          W Offline
          W Offline
          wowy
          wrote on last edited by wowy
          #4

          @cybercatalyst
          I am working on ubuntu 14.04.

          I tried getting the source ( https://wiki.qt.io/Qt_Serial_Port#Getting_the_source_code ) but i always had the error :
          fatal: unable to connect to code.qt.io:
          code.qt.io[0: 54.77.201.214]: errno=Connection timed out

          Is there any other way to download them ?

          EDIT : I downloaded it here :
          https://qt.gitorious.org/qt/qtserialport/source/da396bc54b776da682ffdcd2aa61f504d607bc12:

          I tried to follow the qtcreator instruction from here :
          https://wiki.qt.io/Qt_Serial_Port#Build_and_install_from_QtCreator

          I added install argument to my make and then tried to rebuild the project but i have a issue :

          /home/spi/Bureau/qtserialport/qt-qtserialport/src/serialport/qserialport.h:40: error: QtSerialPort/qserialportglobal.h: No such file or directory

          I checked, the file is in the project and in the src folder.

          1 Reply Last reply
          0
          • JKSHJ Offline
            JKSHJ Offline
            JKSH
            Moderators
            wrote on last edited by
            #5

            Hi @wowy ,

            I checked in the installation folder of qt5.2.1

            1. What is the full path to your installation folder?
            2. How did you install Qt 5.2.1?

            If you installed it from the Ubuntu repositories, install Qt Serial Port from the Ubuntu Software Center (libqt5serialport5-dev).

            I tried getting the source ( https://wiki.qt.io/Qt_Serial_Port#Getting_the_source_code )

            Don't do that. There is a high risk that you will end up with multiple copies of the library in your computer, and you will have a hard time debugging if your program links to the wrong version.

            Delete all the source code you downloaded and any binaries you built yourself. Use the official installers.

            Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

            W 1 Reply Last reply
            1
            • JKSHJ JKSH

              Hi @wowy ,

              I checked in the installation folder of qt5.2.1

              1. What is the full path to your installation folder?
              2. How did you install Qt 5.2.1?

              If you installed it from the Ubuntu repositories, install Qt Serial Port from the Ubuntu Software Center (libqt5serialport5-dev).

              I tried getting the source ( https://wiki.qt.io/Qt_Serial_Port#Getting_the_source_code )

              Don't do that. There is a high risk that you will end up with multiple copies of the library in your computer, and you will have a hard time debugging if your program links to the wrong version.

              Delete all the source code you downloaded and any binaries you built yourself. Use the official installers.

              W Offline
              W Offline
              wowy
              wrote on last edited by
              #6

              @JKSH
              But if i use the install from the ubuntu software center it will only install it in the qt5 version i installed using the USC, right ?

              I use qt creator with a qt5 kit and a qt4 kit, i manually installed the qt4 version and i would need to use the serial port too with this version.

              JKSHJ 1 Reply Last reply
              0
              • W wowy

                @JKSH
                But if i use the install from the ubuntu software center it will only install it in the qt5 version i installed using the USC, right ?

                I use qt creator with a qt5 kit and a qt4 kit, i manually installed the qt4 version and i would need to use the serial port too with this version.

                JKSHJ Offline
                JKSHJ Offline
                JKSH
                Moderators
                wrote on last edited by
                #7

                Hi @wowy,

                Please answer the 2 questions in my previous post.

                But if i use the install from the ubuntu software center it will only install it in the qt5 version i installed using the USC, right ?

                Right.

                I use qt creator with a qt5 kit and a qt4 kit, i manually installed the qt4 version and i would need to use the serial port too with this version.

                You only asked for Qt 5 in your original post, so I gave you a Qt 5 solution. Anyway, try that first; focus on getting it working for Qt 5 first. Worry about Qt 4 later.

                Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                V 1 Reply Last reply
                0
                • Z Offline
                  Z Offline
                  zyl0595
                  wrote on last edited by
                  #8

                  I got this problem too ! additionally, you should install libqt5serialport5-dev while libqt5serialport5 has been installed!

                  1 Reply Last reply
                  3
                  • M Offline
                    M Offline
                    MissingNo218
                    wrote on last edited by
                    #9

                    I know this topic is very old and I'm sure everyone on here has figured out a solution, but I wanted to post my solution to this problem. I did the following things for linking QSerialPort to an application using the static build of Qt 5.11.2:

                    1. Build Qt with the -static tag. (Specifically, my configure command was this: "./configure -static -prefix ../PathToQt/ -skip webengine -skip location -skip wayland". I skipped wayland and location because they had errors when compiled against std-c++11)
                    2. Copy "libQt5SerialPort.a" from /PathToQt/qtserialport/lib/ to your project directory
                    3. Copy "qserialport.h", "qserialport.h", and "qserialportinfo.h" from the /PathToQt/qtserialport/src/serialport to your project directory
                    4. Remove "QT += serialport" from your .pro file if it's there.
                    5. Change "#include <QSerialPort>" to "#include "qserialport.h" and "#include <QSerialPortInfo>" to "#include "qserialportinfo.h" where necessary

                    Hope this helps!

                    M 1 Reply Last reply
                    0
                    • M MissingNo218

                      I know this topic is very old and I'm sure everyone on here has figured out a solution, but I wanted to post my solution to this problem. I did the following things for linking QSerialPort to an application using the static build of Qt 5.11.2:

                      1. Build Qt with the -static tag. (Specifically, my configure command was this: "./configure -static -prefix ../PathToQt/ -skip webengine -skip location -skip wayland". I skipped wayland and location because they had errors when compiled against std-c++11)
                      2. Copy "libQt5SerialPort.a" from /PathToQt/qtserialport/lib/ to your project directory
                      3. Copy "qserialport.h", "qserialport.h", and "qserialportinfo.h" from the /PathToQt/qtserialport/src/serialport to your project directory
                      4. Remove "QT += serialport" from your .pro file if it's there.
                      5. Change "#include <QSerialPort>" to "#include "qserialport.h" and "#include <QSerialPortInfo>" to "#include "qserialportinfo.h" where necessary

                      Hope this helps!

                      M Offline
                      M Offline
                      MissingNo218
                      wrote on last edited by
                      #10

                      @MissingNo218 I forgot to add: You also have to add "LIBS += libQt5SerialPort.a" to your .pro file

                      1 Reply Last reply
                      0
                      • D Offline
                        D Offline
                        Dynamo
                        wrote on last edited by
                        #11

                        sudo apt-get install build-essential
                        sudo apt-get install cmake qt5-default qtcreator
                        sudo apt-get install libqt5serialport5
                        sudo apt-get install libqt5serialport5-dev

                        1 Reply Last reply
                        1

                        • Login

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