Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. [Solved] Adding QtSerialPort to 4.6.3
Forum Updated to NodeBB v4.3 + New Features

[Solved] Adding QtSerialPort to 4.6.3

Scheduled Pinned Locked Moved Installation and Deployment
16 Posts 3 Posters 10.5k Views 1 Watching
  • 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.
  • McLionM Offline
    McLionM Offline
    McLion
    wrote on last edited by
    #3

    I read the wiki over and over. The explanations are not very detailed.
    I'll try again with your instructions and post back.

    1 Reply Last reply
    0
    • McLionM Offline
      McLionM Offline
      McLion
      wrote on last edited by
      #4

      OK, I am now trying to simply add it to my local Qt installation and build it under windows. Let's move it to Linux later.

      • I copied to "C:\QtSDK\Desktop\Qt\4.6.3\src\qt-qtserialport"
      • I opened serialport.pro
      • Did Build settings
      • Replaced QElapsedTimer with QTime
      • changed include path in qserialportinfo_win.cpp #include "C:\QtSDK\mingw\include\ddk\cfgmgr32.h"
      • Changed include path in qserialport_win.cpp to #include "qt4support/include/QtCore/qwineventnotifier.h"
        and now getting

      @mingw32-make.exe[1]: Leaving directory `C:/QtSDK/Desktop/Qt/4.6.3/src/qt-qtserialport/src/serialport-build-desktop-Qt_4_6_3_for_Desktop_-_MinGW_Release'
      ..\serialport\qserialportinfo_win.cpp: In static member function 'static QList<QSerialPortInfo> QSerialPortInfo::availablePorts()':
      ..\serialport\qserialportinfo_win.cpp:258: error: 'find_if' is not a member of 'std'
      ..\serialport\qserialportinfo_win.cpp:307: error: 'find_if' is not a member of 'std'@

      1 Reply Last reply
      0
      • McLionM Offline
        McLionM Offline
        McLion
        wrote on last edited by
        #5

        Added #include <algorithm> .... and moving further

        1 Reply Last reply
        0
        • McLionM Offline
          McLionM Offline
          McLion
          wrote on last edited by
          #6

          I think I am missing this step because the libraries are built but not installed:

          • add a new make “Build Step” and write to the “Make arguments” the install target

          ... I am not really sure how to do this ?!?

          1 Reply Last reply
          0
          • McLionM Offline
            McLionM Offline
            McLion
            wrote on last edited by
            #7

            ... found it:

            • Switch to Projects Mode: press Ctrl+5.
            • On Build Settings tab under Build Steps click on Add Build Step.
            • Choose Make from the menu.
            • Write install into Make arguments: text input box.

            .. libraries are installed in local 4.6.3 on windows. :)
            ... moving forward ...

            1 Reply Last reply
            0
            • McLionM Offline
              McLionM Offline
              McLion
              wrote on last edited by
              #8

              Including into a new empty project does not work, returning:
              @release/main.o:main.cpp:(.text+0x66): undefined reference to _imp___ZN15QSerialPortInfo14availablePortsEv' release/main.o:main.cpp:(.text+0xf9): undefined reference to _imp___ZNK15QSerialPortInfo8portNameEv'
              release/main.o:main.cpp:(.text+0x23b): undefined reference to _imp___ZNK15QSerialPortInfo11descriptionEv' release/main.o:main.cpp:(.text+0x374): undefined reference to _imp___ZNK15QSerialPortInfo12manufacturerEv'
              release/main.o:main.cpp:(.text+0x4ab): undefined reference to _imp___ZN11QSerialPortC1EP7QObject' release/main.o:main.cpp:(.text+0x4be): undefined reference to _imp___ZN11QSerialPort7setPortERK15QSerialPortInfo'
              release/main.o:main.cpp:(.text+0x4d5): undefined reference to _imp___ZN11QSerialPort4openE6QFlagsIN9QIODevice12OpenModeFlagEE' release/main.o:main.cpp:(.text+0x4e2): undefined reference to _imp___ZN11QSerialPort5closeEv'
              release/main.o:main.cpp:(.text+0x4eb): undefined reference to _imp___ZN11QSerialPortD1Ev' release/main.o:main.cpp:(.text+0x94a): undefined reference to _imp___ZN11QSerialPortD1Ev'
              release/main.o:main.cpp:(.text$_ZN5QListI15QSerialPortInfoE4freeEPN9QListData4DataE[QList<QSerialPortInfo>::free(QListData::Data*)]+0x36): undefined reference to _imp___ZN15QSerialPortInfoD1Ev' release/main.o:main.cpp:(.text$_ZN5QListI15QSerialPortInfoE13detach_helperEv[QList<QSerialPortInfo>::detach_helper()]+0x68): undefined reference to imp___ZN15QSerialPortInfoC1ERKS'
              release/main.o:main.cpp:(.text$_ZN5QListI15QSerialPortInfoE13detach_helperEv[QList<QSerialPortInfo>::detach_helper()]+0xb6): undefined reference to `_imp___ZN15QSerialPortInfoD1Ev'
              @

              It installed .dll to /bin, .h to /include/QtSerialPort, .a, lib.dll and .prl to /lib. So far, this seems ok to me but it still returns the errors above.

              Any idea?

              1 Reply Last reply
              0
              • McLionM Offline
                McLionM Offline
                McLion
                wrote on last edited by
                #9

                Found it. If its done like in the wiki with adding
                @CONFIG += serialport@

                to the pro, it does not work.
                I had to manually copy the prf from the sources and add:

                @include(C:\QtSDK\Desktop\Qt\4.6.3\lib\serialport.prf)@

                to the pro file (for what ever this file is for ?!?)
                Finally, it runs under windows ... now I'll try to port it to my eLinux environment .. which will be trickier, I assume.

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

                  The serialport.prf should be in \mkspecs\features\ in your Qt place. Then CONFIG += serialport should be work correctly.

                  1 Reply Last reply
                  0
                  • McLionM Offline
                    McLionM Offline
                    McLion
                    wrote on last edited by
                    #11

                    Perfect! Thanks a lot.
                    Now .. moving to Linux ... I'll keep this thread updated

                    1 Reply Last reply
                    0
                    • McLionM Offline
                      McLionM Offline
                      McLion
                      wrote on last edited by
                      #12

                      Needed some changes to the sources. However, one line of code still bugs me:

                      @const qint64 age = QFileInfo(fileName).lastModified().msecsTo(QDateTime::currentDateTime());@

                      msecsTo is not available in QDateTime in 4.6.3.
                      Any idea?

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

                        You can do not use QLockFile.. Just exclude this module/code from compilation (e.g. comments out some places and so on).

                        1 Reply Last reply
                        0
                        • McLionM Offline
                          McLionM Offline
                          McLion
                          wrote on last edited by
                          #14

                          Thanks. Decided to replace
                          @const qint64 age = QFileInfo(fileName).lastModified().msecsTo(QDateTime::currentDateTime());
                          return staleLockTime > 0 && age > staleLockTime;
                          @
                          with
                          @return staleLockTime > 0 && (QDateTime::currentDateTime() > QFileInfo(fileName).lastModified().addMSecs(staleLockTime));@

                          It works! :)
                          Just compiled for my eLinux and used the basics from the wiki reading out port names. Going to replace qextserialport with QtSerialPort now and hope it helpes in solving my communication issue.

                          Thanks for your support and patience.

                          1 Reply Last reply
                          0
                          • M Offline
                            M Offline
                            Mirgos
                            wrote on last edited by
                            #15

                            [quote author="McLion" date="1404925315"]Found it. If its done like in the wiki with adding
                            @CONFIG += serialport@

                            to the pro, it does not work.
                            I had to manually copy the prf from the sources and add:

                            @include(C:\QtSDK\Desktop\Qt\4.6.3\lib\serialport.prf)@

                            to the pro file (for what ever this file is for ?!?)
                            Finally, it runs under windows ... now I'll try to port it to my eLinux environment .. which will be trickier, I assume.
                            [/quote]

                            Did the same, althought serialport.prf is in mkspec/features directory and I've added CONFIG += serialport in *.pro file. Works as intended

                            1 Reply Last reply
                            0
                            • M Offline
                              M Offline
                              Mirgos
                              wrote on last edited by
                              #16

                              [quote author="McLion" date="1404925315"]Found it. If its done like in the wiki with adding
                              @CONFIG += serialport@

                              to the pro, it does not work.
                              I had to manually copy the prf from the sources and add:

                              @include(C:\QtSDK\Desktop\Qt\4.6.3\lib\serialport.prf)@

                              to the pro file (for what ever this file is for ?!?)
                              Finally, it runs under windows ... now I'll try to port it to my eLinux environment .. which will be trickier, I assume.
                              [/quote]

                              Did the same, althought serialport.prf is in mkspec/features directory and I've added CONFIG += serialport in *.pro file. Works as intended

                              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