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. Add MQTT module to QT project

Add MQTT module to QT project

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 2 Posters 1.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.
  • G Offline
    G Offline
    gampo
    wrote on 10 Mar 2021, 08:39 last edited by
    #1

    I am trying to add MQTT functionality in a QT project (based on QGroundControl).
    Just as in this case: How can i add module mqtt to QT? , I am trying to use the QMQTT library. The solution proposed at the aforementioned thread do not seem to work for me (I am using windows).
    I did the following:

    1. added the qmqtt lib folder to E:\QGC\Stable_V4.0\libs
    2. added the command "add_subdirectory(qmqtt)" to the project's CMakeLists.txt
    3. added "#include "qmqtt.h"" to main.c
    4. added the line "QT += mqtt"

    I constantly get the error "Project ERROR: Unknown module(s) in QT: mqtt"

    Any help would be appreciated.

    J 1 Reply Last reply 10 Mar 2021, 08:40
    0
    • G gampo
      10 Mar 2021, 08:39

      I am trying to add MQTT functionality in a QT project (based on QGroundControl).
      Just as in this case: How can i add module mqtt to QT? , I am trying to use the QMQTT library. The solution proposed at the aforementioned thread do not seem to work for me (I am using windows).
      I did the following:

      1. added the qmqtt lib folder to E:\QGC\Stable_V4.0\libs
      2. added the command "add_subdirectory(qmqtt)" to the project's CMakeLists.txt
      3. added "#include "qmqtt.h"" to main.c
      4. added the line "QT += mqtt"

      I constantly get the error "Project ERROR: Unknown module(s) in QT: mqtt"

      Any help would be appreciated.

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 10 Mar 2021, 08:40 last edited by
      #2

      @gampo said in Add MQTT module to QT project:

      E:\QGC\Stable_V4.0\libs

      Is that your Qt installation or why do you add qmqtt there?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • G Offline
        G Offline
        gampo
        wrote on 10 Mar 2021, 08:49 last edited by
        #3

        Thank you very much for responding, let alone so quickly.
        I assumed the project's libs folder should contain all the used libraries, so I added the downloaded lib folder to the project's one.
        Apologies if this is a newbie mistake...

        P.S. took many minute for me to respond due to my being new to the forum and thus having a mandatory 10-minute delay between posts.

        J 1 Reply Last reply 10 Mar 2021, 08:52
        0
        • G gampo
          10 Mar 2021, 08:49

          Thank you very much for responding, let alone so quickly.
          I assumed the project's libs folder should contain all the used libraries, so I added the downloaded lib folder to the project's one.
          Apologies if this is a newbie mistake...

          P.S. took many minute for me to respond due to my being new to the forum and thus having a mandatory 10-minute delay between posts.

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 10 Mar 2021, 08:52 last edited by
          #4

          @gampo You need to add MQTT to your Qt installation to be able to build applications using it.
          Also: 2 and 4 indicate that you're mixing CMake and QMake? So, which one do you want to use?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • G Offline
            G Offline
            gampo
            wrote on 10 Mar 2021, 09:01 last edited by
            #5

            Are you aware of the installation path to which MQTT should be added?
            I assume it must be E:\Qt\5.15.0\Src\qttools\src, right?
            Also , should I add the entire library folder (containing the CMakeLists files etc) or just the folder containing the .h, .cpp, .pro and .pri files?

            As for points 2 and 4, you are right, I mixed things up... I will delete the CMakeList command and only use QMake from at the projects .pro file.

            J 1 Reply Last reply 10 Mar 2021, 09:04
            0
            • G gampo
              10 Mar 2021, 09:01

              Are you aware of the installation path to which MQTT should be added?
              I assume it must be E:\Qt\5.15.0\Src\qttools\src, right?
              Also , should I add the entire library folder (containing the CMakeLists files etc) or just the folder containing the .h, .cpp, .pro and .pri files?

              As for points 2 and 4, you are right, I mixed things up... I will delete the CMakeList command and only use QMake from at the projects .pro file.

              J Offline
              J Offline
              jsulm
              Lifetime Qt Champion
              wrote on 10 Mar 2021, 09:04 last edited by
              #6

              @gampo You should first explain what exactly you're trying to install. What did you actually download exactly?
              Usually you would download source code and do:

              mkdir build_qmqtt
              cd build_qmqtt
              PATH_TO_YOUR_QMAKE ../qmqtt_src
              make
              make install
              

              "make install" would install everything needed in your Qt installation.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              G 1 Reply Last reply 10 Mar 2021, 09:14
              0
              • J jsulm
                10 Mar 2021, 09:04

                @gampo You should first explain what exactly you're trying to install. What did you actually download exactly?
                Usually you would download source code and do:

                mkdir build_qmqtt
                cd build_qmqtt
                PATH_TO_YOUR_QMAKE ../qmqtt_src
                make
                make install
                

                "make install" would install everything needed in your Qt installation.

                G Offline
                G Offline
                gampo
                wrote on 10 Mar 2021, 09:14 last edited by
                #7

                @jsulm
                I downloaded the entire qmqtt repository containing:

                1. an "examples" subfolder
                2. a "src" subfolder containing an "mqtt" sub-subfolder
                3. a "test" subfolder

                All the .h and .cpp files are inside the mqtt sub-subfolder.
                I am on windows so I can sadly not follow the linux installation process...

                J 1 Reply Last reply 10 Mar 2021, 09:20
                0
                • G gampo
                  10 Mar 2021, 09:14

                  @jsulm
                  I downloaded the entire qmqtt repository containing:

                  1. an "examples" subfolder
                  2. a "src" subfolder containing an "mqtt" sub-subfolder
                  3. a "test" subfolder

                  All the .h and .cpp files are inside the mqtt sub-subfolder.
                  I am on windows so I can sadly not follow the linux installation process...

                  J Offline
                  J Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on 10 Mar 2021, 09:20 last edited by
                  #8

                  @gampo Then you first need to build it. What I posted is not really Linux instructions. You have to do the same on Windows also. Use the command prompt from MinGW or MSVC (what ever you're using). make will be either nmake.exe (MSVC) or mingw32-make.exe (MinGW).

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    gampo
                    wrote on 10 Mar 2021, 09:36 last edited by gampo 3 Oct 2021, 09:38
                    #9

                    I opened a MSVC terminal and directed to E:\QtMQTT\qmqtt\build_qmqtt, but can't proceed after that point...

                    Typing "NMAKE: E:\QtMQTT\qmqtt\src gives "'NMAKE:' is not recognized as an internal or external command, operable program or batch file".
                    I am really sorry, I lack the experience with such environments.

                    Edit: I made a pastebin with the folder tree if it helps at all:
                    https://pastebin.com/ZXShYcmT

                    J 1 Reply Last reply 10 Mar 2021, 09:57
                    0
                    • G gampo
                      10 Mar 2021, 09:36

                      I opened a MSVC terminal and directed to E:\QtMQTT\qmqtt\build_qmqtt, but can't proceed after that point...

                      Typing "NMAKE: E:\QtMQTT\qmqtt\src gives "'NMAKE:' is not recognized as an internal or external command, operable program or batch file".
                      I am really sorry, I lack the experience with such environments.

                      Edit: I made a pastebin with the folder tree if it helps at all:
                      https://pastebin.com/ZXShYcmT

                      J Offline
                      J Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on 10 Mar 2021, 09:57 last edited by
                      #10

                      @gampo said in Add MQTT module to QT project:

                      Typing "NMAKE: E:\QtMQTT\qmqtt\src gi

                      First, call qmake.
                      There must not be : after nmake:

                      PATH_TO_QMAKE
                      nmake
                      nmake install
                      

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0

                      1/10

                      10 Mar 2021, 08:39

                      • Login

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