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. Serial Port usage
QtWS25 Last Chance

Serial Port usage

Scheduled Pinned Locked Moved General and Desktop
19 Posts 5 Posters 14.3k 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.
  • MohammadsmM Offline
    MohammadsmM Offline
    Mohammadsm
    wrote on last edited by
    #1

    Hello everyone,
    I'm almost new to Qt. I want to make simple Terminal. I installed Qtserialport on Qt("qt-project.org/wiki/QtSerialPort":http://qt-project.org/wiki/QtSerialPort). But I got many errors during build the example:
    !http://www.8pic.ir/images/76459850893960571532.png(Serial Port)!

    Help me please...

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Alek Śmierciak
      wrote on last edited by
      #2

      Did you remember to modify your .pro file accordingly when dealing with QtSerialPort module, as stated "here":http://qt-project.org/wiki/QtSerialPort#c64518704ce0c0d5501a45763f464276?
      Qt4: @CONFIG += serialport@

      Qt5: @QT += serialport@

      1 Reply Last reply
      0
      • MohammadsmM Offline
        MohammadsmM Offline
        Mohammadsm
        wrote on last edited by
        #3

        Of course
        !http://www.8pic.ir/images/69095489733339612573.png(Serial Port)!

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Alek Śmierciak
          wrote on last edited by
          #4

          You seem to have added the line for Qt4. The one for Qt5 is different - are you really using Qt4 library (not sure, since the project is from 26th of May and you use greaterThan conditional)?

          In either case, the line for Qt5 can go into such a conditional as well.

          1 Reply Last reply
          0
          • MohammadsmM Offline
            MohammadsmM Offline
            Mohammadsm
            wrote on last edited by
            #5

            Thank you for your attention,Alek
            I tried That one for Qt5, but no different:
            !http://www.8pic.ir/images/28121612802292626722.png(Serial Port)!

            1 Reply Last reply
            0
            • sierdzioS Offline
              sierdzioS Offline
              sierdzio
              Moderators
              wrote on last edited by
              #6

              This just shows Qt version that Qt Creator was built with! To check which version are you using, see Kits in Options->Build & Run, or your project settings.

              (Z(:^

              1 Reply Last reply
              0
              • MohammadsmM Offline
                MohammadsmM Offline
                Mohammadsm
                wrote on last edited by
                #7

                !http://www.8pic.ir/images/19267283463456159770.png(Serial Port)!

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  Alek Śmierciak
                  wrote on last edited by
                  #8

                  Well, you're using Qt 4.8.1 and not Qt5 indeed, so you definitely should include the QtSerialPort module the Qt4 way (leaving the Qt5 line in a conditional or just removing it).

                  1 Reply Last reply
                  0
                  • sierdzioS Offline
                    sierdzioS Offline
                    sierdzio
                    Moderators
                    wrote on last edited by
                    #9

                    Are you sure you've installed QtSerialPort correctly, then? Have you set QTDIR before running make install? It seems you have Qt4 that comes with Ubuntu. I have not tried using serial port with that version of Qt, I can't confirm it works (I'm building Qt myself).

                    (Z(:^

                    1 Reply Last reply
                    0
                    • MohammadsmM Offline
                      MohammadsmM Offline
                      Mohammadsm
                      wrote on last edited by
                      #10

                      Yes,after installation,"QtSerialPort" folder created in includes folder:
                      !http://www.8pic.ir/images/97864825867755441174.png(Serial Port)!

                      1 Reply Last reply
                      0
                      • sierdzioS Offline
                        sierdzioS Offline
                        sierdzio
                        Moderators
                        wrote on last edited by
                        #11

                        I guess it looks for includes in /usr/include/qt4/4.8.1/include. Try adding this to your .pro file as a workaround, or reinstall QtSerialPort:
                        @
                        INCLUDEPATH += /usr/include/qt4
                        @

                        (Z(:^

                        1 Reply Last reply
                        0
                        • MohammadsmM Offline
                          MohammadsmM Offline
                          Mohammadsm
                          wrote on last edited by
                          #12

                          QtSerialPort defined to Qt, cause the compiler doesn't get error for the headers(first image).
                          May be I have to try it with other versions of QtSerialPort.
                          If you find a way to solve my problem, tell me please.
                          In either case, Thank you all.

                          1 Reply Last reply
                          0
                          • sierdzioS Offline
                            sierdzioS Offline
                            sierdzio
                            Moderators
                            wrote on last edited by
                            #13

                            Try including:
                            @
                            #include <QSerialPort>
                            #include <QSerialPortInfo
                            @
                            instead. Maybe it sees the module headers but not the concrete ones. That's a shot in the dark, though.

                            (Z(:^

                            1 Reply Last reply
                            0
                            • MohammadsmM Offline
                              MohammadsmM Offline
                              Mohammadsm
                              wrote on last edited by
                              #14

                              Thank you very much sierdzio,
                              No different:
                              !http://www.8pic.ir/images/72918578813541034521.png(Serial Port)!

                              1 Reply Last reply
                              0
                              • K Offline
                                K Offline
                                kuzulis
                                Qt Champions 2020
                                wrote on last edited by
                                #15

                                Mohammadsm,

                                1. Try to remove all QtSerialPort parts from system - to remove all directories from /usr/include/qt4/QtSerialPort and all *.so (by searching), etc. from system directories of your Ubuntu (I don't know where to place in Ubuntu packages with Qt4/Qt5 are installed, I don't use Ubuntu).

                                2. Try rebuild and reinstall QtSerialPort from QtCreator. It will allow to generate Makefile with the necessary QTDIR, etc. automatically, just do:

                                • open qtserialport.pro with your Qt4.8.1 kit
                                • add to QtCreator tab with "project build configuration page" the new Make target like "sudo install"
                                • rebuild library

                                In this case the library will be compiled and be installed automatically from QtCreator.

                                PS: here I am not sure that "sudo" will correctly be executed from QtCreator, I didn't check.

                                1. If "sudo" isn't executed, you run the terminal, cd to a build directory with library (like "qtserialport-build-4_8_1_Desktop-Release") and execute manually "sudo install" from terminal. It has to help.
                                1 Reply Last reply
                                0
                                • MohammadsmM Offline
                                  MohammadsmM Offline
                                  Mohammadsm
                                  wrote on last edited by
                                  #16

                                  Yessss,I made it,finally.I found where was the bug!
                                  !http://www.8pic.ir/images/09264115279337141243.png(Serial Port)!
                                  The "QT_MAJOR_VERSION" was "5".
                                  This source provided for Qt5, I just changed the version number.
                                  !http://www.8pic.ir/images/99918515869336409977.png(Serial Port)!

                                  Thank you all,very much

                                  1 Reply Last reply
                                  0
                                  • T Offline
                                    T Offline
                                    tobias.hunger
                                    wrote on last edited by
                                    #17

                                    Is this a special ubuntu phone SDK creator or are those ubuntu plugins part of every Qt Creator installation on ubuntu?

                                    1 Reply Last reply
                                    0
                                    • MohammadsmM Offline
                                      MohammadsmM Offline
                                      Mohammadsm
                                      wrote on last edited by
                                      #18

                                      If I understand you, it's the external Ubuntu Phone SDK not included in Qt and I installed it form "Go moile":http://developer.ubuntu.com/get-started/gomobile/.
                                      !http://www.8pic.ir/images/15454816010375575771.png(Ubuntu Phone SDK)!

                                      1 Reply Last reply
                                      0
                                      • T Offline
                                        T Offline
                                        tobias.hunger
                                        wrote on last edited by
                                        #19

                                        /me sighs.

                                        Did they really break keyboard shortcuts for that stupid page? We made the welcome mode extendable so that people can put their pages there together with the others...

                                        1 Reply Last reply
                                        0

                                        • Login

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