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
Forum Updated to NodeBB v4.3 + New Features

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.
  • gampoG Offline
    gampoG Offline
    gampo
    wrote on 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.

    jsulmJ 1 Reply Last reply
    0
    • gampoG gampo

      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.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on 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
      • gampoG Offline
        gampoG Offline
        gampo
        wrote on 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.

        jsulmJ 1 Reply Last reply
        0
        • gampoG gampo

          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.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on 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
          • gampoG Offline
            gampoG Offline
            gampo
            wrote on 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.

            jsulmJ 1 Reply Last reply
            0
            • gampoG gampo

              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.

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on 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

              gampoG 1 Reply Last reply
              0
              • jsulmJ jsulm

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

                gampoG Offline
                gampoG Offline
                gampo
                wrote on 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...

                jsulmJ 1 Reply Last reply
                0
                • gampoG gampo

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

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on 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
                  • gampoG Offline
                    gampoG Offline
                    gampo
                    wrote on last edited by gampo
                    #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

                    jsulmJ 1 Reply Last reply
                    0
                    • gampoG gampo

                      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

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on 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

                      • Login

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