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. How can I use the QtMqtt code?

How can I use the QtMqtt code?

Scheduled Pinned Locked Moved Solved General and Desktop
15 Posts 4 Posters 3.6k 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.
  • J Offline
    J Offline
    JoeBermejales
    wrote on 14 Mar 2019, 10:57 last edited by
    #1

    Re: How can i add module mqtt to QT?

    Hi,

    I tried to follow the indications in the link above, but I am not able to compile and use the official QtMqtt source code placed in https://github.com/qt/qtmqtt.

    As shown in the following screenshot, I'm using the Qt Creator because the Qt console didn't work neither. My setup: Windows 7 - MSVC2015 - Qt 5.12. I opened the code and tried to execute qmake and build in the .pro files inside (not sure what were the correct one).

    0_1552560738283_0d84c92a-82eb-4183-aa9c-fcb526fd7823-image.png

    I know this is a basic question, but, how can I integrate the available QtMqtt source code to my own project? I really would appreciate some indications.

    Thanks!!

    http://reparacionplotter.com

    1 Reply Last reply
    0
    • J JoeBermejales
      20 Mar 2019, 07:55

      @SGaist

      perl -v
      
      This is perl 5, version 26, subversion 3 (v5.26.3) built for MSWin32-x64-multi-thread
      (with 2 registered patches, see perl -V for more detail)
      
      perl -V
      
      Summary of my perl5 (revision 5 version 26 subversion 3) configuration:
      
        Platform:
          osname=MSWin32
          osvers=6.1.7601
          archname=MSWin32-x64-multi-thread
          uname=''
          config_args='undef'
          hint=recommended
          useposix=true
          d_sigaction=undef
          useithreads=define
          usemultiplicity=define
          use64bitint=define
          use64bitall=undef
          uselongdouble=undef
          usemymalloc=n
          default_inc_excludes_dot=define
          bincompat5005=undef
        Compiler:
          cc='C:\PROGRA~1\MINGW-~1\X86_64~1.0-W\mingw64\bin\gcc.exe'
          ccflags =' -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -DPERL_TEXTMODE_SCRIPTS -DU
      SE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fwrapv -fno-strict
      -aliasing -mms-bitfields'
          optimize='-s -O2'
          cppflags='-DWIN32'
          ccversion=''
          gccversion='4.6.3'
          gccosandvers=''
          intsize=4
          longsize=4
          ptrsize=8
          doublesize=8
          byteorder=12345678
          doublekind=3
          d_longlong=define
          longlongsize=8
          d_longdbl=define
          longdblsize=16
          longdblkind=3
          ivtype='long long'
          ivsize=8
          nvtype='double'
          nvsize=8
          Off_t='long long'
          lseeksize=8
          alignbytes=8
          prototype=define
        Linker and Libraries:
          ld='C:\PROGRA~1\MINGW-~1\X86_64~1.0-W\mingw64\bin\g++.exe'
          ldflags ='-s -static-libgcc -static-libstdc++ -L"C:\Perl64\lib\CORE" -L"C:\M
      inGW\x86_64-w64-mingw32\lib"'
          libpth=C:\MinGW\x86_64-w64-mingw32\lib
          libs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32
       -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion
       -lodbc32 -lodbccp32 -lcomctl32
          perllibs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladva
      pi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lver
      sion -lodbc32 -lodbccp32 -lcomctl32
          libc=
          so=dll
          useshrplib=true
          libperl=libperl526.a
          gnulibc_version=''
        Dynamic Linking:
          dlsrc=dl_win32.xs
          dlext=dll
          d_dlsymun=undef
          ccdlflags=' '
          cccdlflags=' '
          lddlflags='-mdll -s -static-libgcc -static-libstdc++ -L"C:\Perl64\lib\CORE"
      -L"C:\MinGW\x86_64-w64-mingw32\lib"'
      
      
      Characteristics of this binary (from libperl):
        Compile-time options:
          HAS_TIMES
          HAVE_INTERP_INTERN
          MULTIPLICITY
          PERLIO_LAYERS
          PERL_COPY_ON_WRITE
          PERL_DONT_CREATE_GVSV
          PERL_IMPLICIT_CONTEXT
          PERL_IMPLICIT_SYS
          PERL_MALLOC_WRAP
          PERL_OP_PARENT
          PERL_PRESERVE_IVUV
          USE_64_BIT_INT
          USE_ITHREADS
          USE_LARGE_FILES
          USE_LOCALE
          USE_LOCALE_COLLATE
          USE_LOCALE_CTYPE
          USE_LOCALE_NUMERIC
          USE_LOCALE_TIME
          USE_PERLIO
          USE_PERL_ATOF
          USE_SITECUSTOMIZE
        Locally applied patches:
          ActivePerl Build 2603 [a95bce075]
          f79ab36645 win32: Fix installsitebin and installsitescript entries in Config
      _heavy.pl
        Built under MSWin32
        Compiled at Dec 17 2018 09:46:45
        @INC:
          C:/Perl64/site/lib
          C:/Perl64/lib
      

      Edit: I tried in another computer (W7 64bits - Mingw 5.3.0 - Qt 5.11.2) and same error: QtMqtt/qmqttglobal.h file not found

      J Offline
      J Offline
      JoeBermejales
      wrote on 20 Mar 2019, 09:05 last edited by JoeBermejales
      #13

      @JoeBermejales HI, finally I modified the source code and it works!! I removed the QtMqtt/ in the includes as shown in the following screenshots:

      I changed this:
      0_1553072624291_baa7a81b-9c50-43ff-818d-ba51a274468b-image.png

      For this, en every .h file:
      0_1553072682284_aebd950b-4ec6-4c82-a85d-d7b4999be662-image.png

      And now it compiles!!!

      Thanks to @SGaist and @Pablo-J-Rogina for your help! :)

      I summarize here the way I achieved to compile and use the official Mqtt source code in Windows 7 Pro:

      1. Download source code from https://github.com/qt/qtmqtt (pay attention to your Qt version)
      2. Extract the zip and open the root .pro project with Qt Creator and navigate to src .h files
      3. Remove all the necessary <QtMqtt/ prefixes in order the routes to be recognized and fix the path errors presented on .h files
      4. Compile for your current kit (in our case, Windows 7 64 MSVC 2015 Community Edition 64 bits Qt 5.12.2)
      5. Copy the .h files and lib directory to your local lib path
      6. Add the following code to your .pro file (correct the relative routes if necessary)
      win32:CONFIG(release, debug|release): LIBS += -L$$PWD/mqtt/lib/ -lQt5Mqtt
      else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/mqtt/lib/ -lQt5Mqttd
      INCLUDEPATH += $$PWD/mqtt/src
      DEPENDPATH += $$PWD/mqtt/src
      win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/mqtt/lib/Qt5Mqtt.lib
      else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/mqtt/lib/Qt5Mqttd.lib
      
      1. In your code, you can include the library classes as follow:
      #include <qmqttclient.h>
      

      http://reparacionplotter.com

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on 14 Mar 2019, 11:05 last edited by
        #2

        Hi,

        If you use Qt 5.12, you'll already have the module with Qt so no need to build it by hand.

        The Qt Creator About Box doesn't give the information about what version of Qt you are using but from the looks of it, you have Qt 5.12.2.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        J Pablo J. RoginaP 2 Replies Last reply 14 Mar 2019, 11:28
        4
        • SGaistS SGaist
          14 Mar 2019, 11:05

          Hi,

          If you use Qt 5.12, you'll already have the module with Qt so no need to build it by hand.

          The Qt Creator About Box doesn't give the information about what version of Qt you are using but from the looks of it, you have Qt 5.12.2.

          J Offline
          J Offline
          JoeBermejales
          wrote on 14 Mar 2019, 11:28 last edited by JoeBermejales
          #3

          @SGaist thanks you for the instant response! but I get the following error:

          0_1552562738470_3e9b83b1-0866-4300-ac47-4885d4c2d628-image.png

          0_1552562792494_6873923e-1c15-4b49-ac0b-65f4a0913db9-image.png

          Does this apply to my current config (MSVC2015 - Qt12.2.2 - W7 ) ??

          0_1552562859504_10f7d603-4c58-48a4-b7cd-f971b4d0d16a-image.png

          http://reparacionplotter.com

          1 Reply Last reply
          0
          • SGaistS SGaist
            14 Mar 2019, 11:05

            Hi,

            If you use Qt 5.12, you'll already have the module with Qt so no need to build it by hand.

            The Qt Creator About Box doesn't give the information about what version of Qt you are using but from the looks of it, you have Qt 5.12.2.

            Pablo J. RoginaP Offline
            Pablo J. RoginaP Offline
            Pablo J. Rogina
            wrote on 14 Mar 2019, 18:37 last edited by
            #4

            @SGaist said in How can I use the QtMqtt code?:

            you'll already have the module with Qt so no need to build it by hand.

            Qt MQTT is not part of "standard" Qt 5.12 distribution... From documentation:

            Note: Qt MQTT is part of the Qt for Automation offering and not Qt. For further details please see Qt for Automation.

            @JoeBermejales have you try building the module from command line?, like this:

            git clone git://code.qt.io/qt/mqtt.git -b 5.12
            cd mqtt
            qmake
            make
            make install
            

            Upvote the answer(s) that helped you solve the issue
            Use "Topic Tools" button to mark your post as Solved
            Add screenshots via postimage.org
            Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

            J 1 Reply Last reply 15 Mar 2019, 12:59
            4
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on 14 Mar 2019, 20:47 last edited by
              #5

              @Pablo-J-Rogina Good catch ! I forgot about that.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • Pablo J. RoginaP Pablo J. Rogina
                14 Mar 2019, 18:37

                @SGaist said in How can I use the QtMqtt code?:

                you'll already have the module with Qt so no need to build it by hand.

                Qt MQTT is not part of "standard" Qt 5.12 distribution... From documentation:

                Note: Qt MQTT is part of the Qt for Automation offering and not Qt. For further details please see Qt for Automation.

                @JoeBermejales have you try building the module from command line?, like this:

                git clone git://code.qt.io/qt/mqtt.git -b 5.12
                cd mqtt
                qmake
                make
                make install
                
                J Offline
                J Offline
                JoeBermejales
                wrote on 15 Mar 2019, 12:59 last edited by JoeBermejales
                #6

                @Pablo-J.-Rogina said in How can I use the QtMqtt code?:

                @JoeBermejales have you try building the module from command line?, like this:

                Yes, but I get some errors. I did the following:

                • I downloaded the qtmqtt 5.11.2 branch (corresponding to my Qt current version -in previous question and setup it was 5.12.2, but get the same error-) and extracted to the following path:

                0_1552654365460_c8129aeb-494e-4175-a7fe-efd4eafd5902-image.png

                • I opened the Qt console and navigate to the path and executed the qmake and make commands that you described:

                0_1552654459379_f7274d56-d30c-4891-843c-12e2d1fd84b1-image.png

                0_1552654563937_9ea85648-709f-4fd7-a58d-b047b247996c-image.png

                • qmake seems to be valid:

                0_1552654583199_f7bbf2a5-e3e5-4fd4-be00-e8178cf2372b-image.png

                • But make is not:
                  0_1552654642478_f5e0f45d-936e-4ccf-96f5-b3914259535e-image.png

                • So I tried with mingw32-make and get the following error:

                0_1552654724704_d93f8f4c-0049-4087-bfca-105620859eb8-image.png

                
                C:\Qt\5.11.2\mingw53_32\qtmqtt-5.11.2\qtmqtt-5.11.2>mingw32-make
                cd src\ && ( if not exist Makefile C:\Qt\5.11.2\mingw53_32\bin\qmake.exe -o Makefile C:\Qt\5.11.2\mingw53_32\qtmqtt-5.11
                .2\qtmqtt-5.11.2\src\src.pro ) && mingw32-make -f Makefile
                mingw32-make[1]: Entering directory 'C:/Qt/5.11.2/mingw53_32/qtmqtt-5.11.2/qtmqtt-5.11.2/src'
                cd mqtt\ && ( if not exist Makefile C:\Qt\5.11.2\mingw53_32\bin\qmake.exe -o Makefile C:\Qt\5.11.2\mingw53_32\qtmqtt-5.1
                1.2\qtmqtt-5.11.2\src\mqtt\mqtt.pro ) && mingw32-make -f Makefile
                mingw32-make[2]: Entering directory 'C:/Qt/5.11.2/mingw53_32/qtmqtt-5.11.2/qtmqtt-5.11.2/src/mqtt'
                mingw32-make -f Makefile.Release all
                mingw32-make[3]: Entering directory 'C:/Qt/5.11.2/mingw53_32/qtmqtt-5.11.2/qtmqtt-5.11.2/src/mqtt'
                g++ -c -fno-keep-inline-dllexport -msse2 -mstackrealign -mfpmath=sse -O2 -std=c++1y -fno-exceptions -Wall -W -Wextra -Wv
                la -Wdate-time -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -DQT_NO_NARRO
                WING_CONVERSIONS_IN_CONNECT -DQT_BUILD_MQTT_LIB -DQT_BUILDING_QT -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES -DQT_NO_C
                AST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPR
                ECATED_BEFORE=0x040800 -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I..\..\include -I..\..\inclu
                de\QtMqtt -IC:/Qt/5.11.2/mingw53_32/qtmqtt-5.11.2/qtmqtt-5.11.2/include/QtMqtt/5.11.2 -IC:/Qt/5.11.2/mingw53_32/qtmqtt-5
                .11.2/qtmqtt-5.11.2/include/QtMqtt/5.11.2/QtMqtt -Itmp -IC:\Qt\5.11.2\mingw53_32\include -IC:\Qt\5.11.2\mingw53_32\inclu
                de\QtNetwork -IC:\Qt\5.11.2\mingw53_32\include\QtCore\5.11.2 -IC:\Qt\5.11.2\mingw53_32\include\QtCore\5.11.2\QtCore -IC:
                \Qt\5.11.2\mingw53_32\include\QtCore -I.moc\release -IC:\openssl\include -IC:\Utils\my_sql\mysql-5.6.11-win32\include -I
                C:\Utils\postgresql\pgsql\include -IC:\Qt\5.11.2\mingw53_32\mkspecs\win32-g++  -o .obj\release\qmqttclient.o qmqttclient
                .cpp
                In file included from qmqttclient.cpp:30:0:
                qmqttclient.h:33:32: fatal error: QtMqtt/qmqttglobal.h: No such file or directory
                compilation terminated.
                Makefile.Release:571: recipe for target '.obj/release/qmqttclient.o' failed
                mingw32-make[3]: *** [.obj/release/qmqttclient.o] Error 1
                mingw32-make[3]: Leaving directory 'C:/Qt/5.11.2/mingw53_32/qtmqtt-5.11.2/qtmqtt-5.11.2/src/mqtt'
                Makefile:40: recipe for target 'release-all' failed
                mingw32-make[2]: *** [release-all] Error 2
                mingw32-make[2]: Leaving directory 'C:/Qt/5.11.2/mingw53_32/qtmqtt-5.11.2/qtmqtt-5.11.2/src/mqtt'
                Makefile:40: recipe for target 'sub-mqtt-make_first' failed
                mingw32-make[1]: *** [sub-mqtt-make_first] Error 2
                mingw32-make[1]: Leaving directory 'C:/Qt/5.11.2/mingw53_32/qtmqtt-5.11.2/qtmqtt-5.11.2/src'
                Makefile:42: recipe for target 'sub-src-make_first' failed
                mingw32-make: *** [sub-src-make_first] Error 2
                
                C:\Qt\5.11.2\mingw53_32\qtmqtt-5.11.2\qtmqtt-5.11.2>
                

                Any idea what is going on?

                Thanks for your help

                http://reparacionplotter.com

                Pablo J. RoginaP 1 Reply Last reply 15 Mar 2019, 13:55
                0
                • J JoeBermejales
                  15 Mar 2019, 12:59

                  @Pablo-J.-Rogina said in How can I use the QtMqtt code?:

                  @JoeBermejales have you try building the module from command line?, like this:

                  Yes, but I get some errors. I did the following:

                  • I downloaded the qtmqtt 5.11.2 branch (corresponding to my Qt current version -in previous question and setup it was 5.12.2, but get the same error-) and extracted to the following path:

                  0_1552654365460_c8129aeb-494e-4175-a7fe-efd4eafd5902-image.png

                  • I opened the Qt console and navigate to the path and executed the qmake and make commands that you described:

                  0_1552654459379_f7274d56-d30c-4891-843c-12e2d1fd84b1-image.png

                  0_1552654563937_9ea85648-709f-4fd7-a58d-b047b247996c-image.png

                  • qmake seems to be valid:

                  0_1552654583199_f7bbf2a5-e3e5-4fd4-be00-e8178cf2372b-image.png

                  • But make is not:
                    0_1552654642478_f5e0f45d-936e-4ccf-96f5-b3914259535e-image.png

                  • So I tried with mingw32-make and get the following error:

                  0_1552654724704_d93f8f4c-0049-4087-bfca-105620859eb8-image.png

                  
                  C:\Qt\5.11.2\mingw53_32\qtmqtt-5.11.2\qtmqtt-5.11.2>mingw32-make
                  cd src\ && ( if not exist Makefile C:\Qt\5.11.2\mingw53_32\bin\qmake.exe -o Makefile C:\Qt\5.11.2\mingw53_32\qtmqtt-5.11
                  .2\qtmqtt-5.11.2\src\src.pro ) && mingw32-make -f Makefile
                  mingw32-make[1]: Entering directory 'C:/Qt/5.11.2/mingw53_32/qtmqtt-5.11.2/qtmqtt-5.11.2/src'
                  cd mqtt\ && ( if not exist Makefile C:\Qt\5.11.2\mingw53_32\bin\qmake.exe -o Makefile C:\Qt\5.11.2\mingw53_32\qtmqtt-5.1
                  1.2\qtmqtt-5.11.2\src\mqtt\mqtt.pro ) && mingw32-make -f Makefile
                  mingw32-make[2]: Entering directory 'C:/Qt/5.11.2/mingw53_32/qtmqtt-5.11.2/qtmqtt-5.11.2/src/mqtt'
                  mingw32-make -f Makefile.Release all
                  mingw32-make[3]: Entering directory 'C:/Qt/5.11.2/mingw53_32/qtmqtt-5.11.2/qtmqtt-5.11.2/src/mqtt'
                  g++ -c -fno-keep-inline-dllexport -msse2 -mstackrealign -mfpmath=sse -O2 -std=c++1y -fno-exceptions -Wall -W -Wextra -Wv
                  la -Wdate-time -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -DQT_NO_NARRO
                  WING_CONVERSIONS_IN_CONNECT -DQT_BUILD_MQTT_LIB -DQT_BUILDING_QT -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES -DQT_NO_C
                  AST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPR
                  ECATED_BEFORE=0x040800 -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I..\..\include -I..\..\inclu
                  de\QtMqtt -IC:/Qt/5.11.2/mingw53_32/qtmqtt-5.11.2/qtmqtt-5.11.2/include/QtMqtt/5.11.2 -IC:/Qt/5.11.2/mingw53_32/qtmqtt-5
                  .11.2/qtmqtt-5.11.2/include/QtMqtt/5.11.2/QtMqtt -Itmp -IC:\Qt\5.11.2\mingw53_32\include -IC:\Qt\5.11.2\mingw53_32\inclu
                  de\QtNetwork -IC:\Qt\5.11.2\mingw53_32\include\QtCore\5.11.2 -IC:\Qt\5.11.2\mingw53_32\include\QtCore\5.11.2\QtCore -IC:
                  \Qt\5.11.2\mingw53_32\include\QtCore -I.moc\release -IC:\openssl\include -IC:\Utils\my_sql\mysql-5.6.11-win32\include -I
                  C:\Utils\postgresql\pgsql\include -IC:\Qt\5.11.2\mingw53_32\mkspecs\win32-g++  -o .obj\release\qmqttclient.o qmqttclient
                  .cpp
                  In file included from qmqttclient.cpp:30:0:
                  qmqttclient.h:33:32: fatal error: QtMqtt/qmqttglobal.h: No such file or directory
                  compilation terminated.
                  Makefile.Release:571: recipe for target '.obj/release/qmqttclient.o' failed
                  mingw32-make[3]: *** [.obj/release/qmqttclient.o] Error 1
                  mingw32-make[3]: Leaving directory 'C:/Qt/5.11.2/mingw53_32/qtmqtt-5.11.2/qtmqtt-5.11.2/src/mqtt'
                  Makefile:40: recipe for target 'release-all' failed
                  mingw32-make[2]: *** [release-all] Error 2
                  mingw32-make[2]: Leaving directory 'C:/Qt/5.11.2/mingw53_32/qtmqtt-5.11.2/qtmqtt-5.11.2/src/mqtt'
                  Makefile:40: recipe for target 'sub-mqtt-make_first' failed
                  mingw32-make[1]: *** [sub-mqtt-make_first] Error 2
                  mingw32-make[1]: Leaving directory 'C:/Qt/5.11.2/mingw53_32/qtmqtt-5.11.2/qtmqtt-5.11.2/src'
                  Makefile:42: recipe for target 'sub-src-make_first' failed
                  mingw32-make: *** [sub-src-make_first] Error 2
                  
                  C:\Qt\5.11.2\mingw53_32\qtmqtt-5.11.2\qtmqtt-5.11.2>
                  

                  Any idea what is going on?

                  Thanks for your help

                  Pablo J. RoginaP Offline
                  Pablo J. RoginaP Offline
                  Pablo J. Rogina
                  wrote on 15 Mar 2019, 13:55 last edited by
                  #7

                  @JoeBermejales maybe this post I did some time ago should help.

                  It looks like you need to ask qmake to recurse subdirs with the -r argument.

                  Upvote the answer(s) that helped you solve the issue
                  Use "Topic Tools" button to mark your post as Solved
                  Add screenshots via postimage.org
                  Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                  J 1 Reply Last reply 18 Mar 2019, 12:31
                  2
                  • Pablo J. RoginaP Pablo J. Rogina
                    15 Mar 2019, 13:55

                    @JoeBermejales maybe this post I did some time ago should help.

                    It looks like you need to ask qmake to recurse subdirs with the -r argument.

                    J Offline
                    J Offline
                    JoeBermejales
                    wrote on 18 Mar 2019, 12:31 last edited by
                    #8

                    @Pablo-J.-Rogina thank you, but after following the suggested instructions nothing seems to work, and I had multiple errors, so I started from the beginning with Qt Creator.

                    1. I downloaded and extracted the 5.12.2 Mqtt version corresponding to my Qt working version.
                      0_1552911676522_1e5722ec-2812-418a-8a95-f7ff1825b5ae-image.png

                    2. I opened the root level .pro file

                    0_1552911770125_27356426-832a-4046-a549-b6e181b2942e-image.png

                    1. I configured with the Qt 5.12.2 MSVC2015 64bit version:

                    0_1552911810756_b45da8da-83fa-4bb3-bd25-929da28dd9ac-image.png

                    1. I get the following errors:

                    0_1552911850606_b02db119-9b47-4439-a8e3-e07f078a71d9-image.png

                    1. If i try to build the project, I get the following errors:

                    0_1552911934174_ca6c93c8-e16f-46fb-ae77-2a87bbcad061-image.png
                    6. After the previous errors, I first execute qmake from Qt Creator (Build -> Run qmake) and seems to work fine with no errors:

                    0_1552912087070_82aaf512-2edd-4cad-9a18-edd5e329f46a-image.png

                    1. I build again but the original errors remain:
                      0_1552912196214_a335324e-07bc-49a0-9947-6bf951a6a6c0-image.png

                    Please, any idea?

                    Thanks

                    http://reparacionplotter.com

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 18 Mar 2019, 22:04 last edited by
                      #9

                      Do you have perl installed on your machine ?

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      J 1 Reply Last reply 19 Mar 2019, 14:38
                      0
                      • SGaistS SGaist
                        18 Mar 2019, 22:04

                        Do you have perl installed on your machine ?

                        J Offline
                        J Offline
                        JoeBermejales
                        wrote on 19 Mar 2019, 14:38 last edited by
                        #10

                        @SGaist yes, and I tried to reinstall Qt 5.12.2 with Mingw 7.3.0 64bits and get the same errors:

                        0_1553006226110_e07b43fb-5441-4876-8158-cca84068f1f5-image.png

                        I will try in another computer, we really need the QtMqtt code to communicate to a remote device.

                        Thanks again @SGaist

                        http://reparacionplotter.com

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on 19 Mar 2019, 23:34 last edited by
                          #11

                          Which version of perl do you have ?

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          J 1 Reply Last reply 20 Mar 2019, 07:55
                          0
                          • SGaistS SGaist
                            19 Mar 2019, 23:34

                            Which version of perl do you have ?

                            J Offline
                            J Offline
                            JoeBermejales
                            wrote on 20 Mar 2019, 07:55 last edited by JoeBermejales
                            #12

                            @SGaist

                            perl -v
                            
                            This is perl 5, version 26, subversion 3 (v5.26.3) built for MSWin32-x64-multi-thread
                            (with 2 registered patches, see perl -V for more detail)
                            
                            perl -V
                            
                            Summary of my perl5 (revision 5 version 26 subversion 3) configuration:
                            
                              Platform:
                                osname=MSWin32
                                osvers=6.1.7601
                                archname=MSWin32-x64-multi-thread
                                uname=''
                                config_args='undef'
                                hint=recommended
                                useposix=true
                                d_sigaction=undef
                                useithreads=define
                                usemultiplicity=define
                                use64bitint=define
                                use64bitall=undef
                                uselongdouble=undef
                                usemymalloc=n
                                default_inc_excludes_dot=define
                                bincompat5005=undef
                              Compiler:
                                cc='C:\PROGRA~1\MINGW-~1\X86_64~1.0-W\mingw64\bin\gcc.exe'
                                ccflags =' -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -DPERL_TEXTMODE_SCRIPTS -DU
                            SE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fwrapv -fno-strict
                            -aliasing -mms-bitfields'
                                optimize='-s -O2'
                                cppflags='-DWIN32'
                                ccversion=''
                                gccversion='4.6.3'
                                gccosandvers=''
                                intsize=4
                                longsize=4
                                ptrsize=8
                                doublesize=8
                                byteorder=12345678
                                doublekind=3
                                d_longlong=define
                                longlongsize=8
                                d_longdbl=define
                                longdblsize=16
                                longdblkind=3
                                ivtype='long long'
                                ivsize=8
                                nvtype='double'
                                nvsize=8
                                Off_t='long long'
                                lseeksize=8
                                alignbytes=8
                                prototype=define
                              Linker and Libraries:
                                ld='C:\PROGRA~1\MINGW-~1\X86_64~1.0-W\mingw64\bin\g++.exe'
                                ldflags ='-s -static-libgcc -static-libstdc++ -L"C:\Perl64\lib\CORE" -L"C:\M
                            inGW\x86_64-w64-mingw32\lib"'
                                libpth=C:\MinGW\x86_64-w64-mingw32\lib
                                libs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32
                             -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion
                             -lodbc32 -lodbccp32 -lcomctl32
                                perllibs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladva
                            pi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lver
                            sion -lodbc32 -lodbccp32 -lcomctl32
                                libc=
                                so=dll
                                useshrplib=true
                                libperl=libperl526.a
                                gnulibc_version=''
                              Dynamic Linking:
                                dlsrc=dl_win32.xs
                                dlext=dll
                                d_dlsymun=undef
                                ccdlflags=' '
                                cccdlflags=' '
                                lddlflags='-mdll -s -static-libgcc -static-libstdc++ -L"C:\Perl64\lib\CORE"
                            -L"C:\MinGW\x86_64-w64-mingw32\lib"'
                            
                            
                            Characteristics of this binary (from libperl):
                              Compile-time options:
                                HAS_TIMES
                                HAVE_INTERP_INTERN
                                MULTIPLICITY
                                PERLIO_LAYERS
                                PERL_COPY_ON_WRITE
                                PERL_DONT_CREATE_GVSV
                                PERL_IMPLICIT_CONTEXT
                                PERL_IMPLICIT_SYS
                                PERL_MALLOC_WRAP
                                PERL_OP_PARENT
                                PERL_PRESERVE_IVUV
                                USE_64_BIT_INT
                                USE_ITHREADS
                                USE_LARGE_FILES
                                USE_LOCALE
                                USE_LOCALE_COLLATE
                                USE_LOCALE_CTYPE
                                USE_LOCALE_NUMERIC
                                USE_LOCALE_TIME
                                USE_PERLIO
                                USE_PERL_ATOF
                                USE_SITECUSTOMIZE
                              Locally applied patches:
                                ActivePerl Build 2603 [a95bce075]
                                f79ab36645 win32: Fix installsitebin and installsitescript entries in Config
                            _heavy.pl
                              Built under MSWin32
                              Compiled at Dec 17 2018 09:46:45
                              @INC:
                                C:/Perl64/site/lib
                                C:/Perl64/lib
                            

                            Edit: I tried in another computer (W7 64bits - Mingw 5.3.0 - Qt 5.11.2) and same error: QtMqtt/qmqttglobal.h file not found

                            http://reparacionplotter.com

                            J 1 Reply Last reply 20 Mar 2019, 09:05
                            0
                            • J JoeBermejales
                              20 Mar 2019, 07:55

                              @SGaist

                              perl -v
                              
                              This is perl 5, version 26, subversion 3 (v5.26.3) built for MSWin32-x64-multi-thread
                              (with 2 registered patches, see perl -V for more detail)
                              
                              perl -V
                              
                              Summary of my perl5 (revision 5 version 26 subversion 3) configuration:
                              
                                Platform:
                                  osname=MSWin32
                                  osvers=6.1.7601
                                  archname=MSWin32-x64-multi-thread
                                  uname=''
                                  config_args='undef'
                                  hint=recommended
                                  useposix=true
                                  d_sigaction=undef
                                  useithreads=define
                                  usemultiplicity=define
                                  use64bitint=define
                                  use64bitall=undef
                                  uselongdouble=undef
                                  usemymalloc=n
                                  default_inc_excludes_dot=define
                                  bincompat5005=undef
                                Compiler:
                                  cc='C:\PROGRA~1\MINGW-~1\X86_64~1.0-W\mingw64\bin\gcc.exe'
                                  ccflags =' -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -DPERL_TEXTMODE_SCRIPTS -DU
                              SE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fwrapv -fno-strict
                              -aliasing -mms-bitfields'
                                  optimize='-s -O2'
                                  cppflags='-DWIN32'
                                  ccversion=''
                                  gccversion='4.6.3'
                                  gccosandvers=''
                                  intsize=4
                                  longsize=4
                                  ptrsize=8
                                  doublesize=8
                                  byteorder=12345678
                                  doublekind=3
                                  d_longlong=define
                                  longlongsize=8
                                  d_longdbl=define
                                  longdblsize=16
                                  longdblkind=3
                                  ivtype='long long'
                                  ivsize=8
                                  nvtype='double'
                                  nvsize=8
                                  Off_t='long long'
                                  lseeksize=8
                                  alignbytes=8
                                  prototype=define
                                Linker and Libraries:
                                  ld='C:\PROGRA~1\MINGW-~1\X86_64~1.0-W\mingw64\bin\g++.exe'
                                  ldflags ='-s -static-libgcc -static-libstdc++ -L"C:\Perl64\lib\CORE" -L"C:\M
                              inGW\x86_64-w64-mingw32\lib"'
                                  libpth=C:\MinGW\x86_64-w64-mingw32\lib
                                  libs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32
                               -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion
                               -lodbc32 -lodbccp32 -lcomctl32
                                  perllibs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladva
                              pi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lver
                              sion -lodbc32 -lodbccp32 -lcomctl32
                                  libc=
                                  so=dll
                                  useshrplib=true
                                  libperl=libperl526.a
                                  gnulibc_version=''
                                Dynamic Linking:
                                  dlsrc=dl_win32.xs
                                  dlext=dll
                                  d_dlsymun=undef
                                  ccdlflags=' '
                                  cccdlflags=' '
                                  lddlflags='-mdll -s -static-libgcc -static-libstdc++ -L"C:\Perl64\lib\CORE"
                              -L"C:\MinGW\x86_64-w64-mingw32\lib"'
                              
                              
                              Characteristics of this binary (from libperl):
                                Compile-time options:
                                  HAS_TIMES
                                  HAVE_INTERP_INTERN
                                  MULTIPLICITY
                                  PERLIO_LAYERS
                                  PERL_COPY_ON_WRITE
                                  PERL_DONT_CREATE_GVSV
                                  PERL_IMPLICIT_CONTEXT
                                  PERL_IMPLICIT_SYS
                                  PERL_MALLOC_WRAP
                                  PERL_OP_PARENT
                                  PERL_PRESERVE_IVUV
                                  USE_64_BIT_INT
                                  USE_ITHREADS
                                  USE_LARGE_FILES
                                  USE_LOCALE
                                  USE_LOCALE_COLLATE
                                  USE_LOCALE_CTYPE
                                  USE_LOCALE_NUMERIC
                                  USE_LOCALE_TIME
                                  USE_PERLIO
                                  USE_PERL_ATOF
                                  USE_SITECUSTOMIZE
                                Locally applied patches:
                                  ActivePerl Build 2603 [a95bce075]
                                  f79ab36645 win32: Fix installsitebin and installsitescript entries in Config
                              _heavy.pl
                                Built under MSWin32
                                Compiled at Dec 17 2018 09:46:45
                                @INC:
                                  C:/Perl64/site/lib
                                  C:/Perl64/lib
                              

                              Edit: I tried in another computer (W7 64bits - Mingw 5.3.0 - Qt 5.11.2) and same error: QtMqtt/qmqttglobal.h file not found

                              J Offline
                              J Offline
                              JoeBermejales
                              wrote on 20 Mar 2019, 09:05 last edited by JoeBermejales
                              #13

                              @JoeBermejales HI, finally I modified the source code and it works!! I removed the QtMqtt/ in the includes as shown in the following screenshots:

                              I changed this:
                              0_1553072624291_baa7a81b-9c50-43ff-818d-ba51a274468b-image.png

                              For this, en every .h file:
                              0_1553072682284_aebd950b-4ec6-4c82-a85d-d7b4999be662-image.png

                              And now it compiles!!!

                              Thanks to @SGaist and @Pablo-J-Rogina for your help! :)

                              I summarize here the way I achieved to compile and use the official Mqtt source code in Windows 7 Pro:

                              1. Download source code from https://github.com/qt/qtmqtt (pay attention to your Qt version)
                              2. Extract the zip and open the root .pro project with Qt Creator and navigate to src .h files
                              3. Remove all the necessary <QtMqtt/ prefixes in order the routes to be recognized and fix the path errors presented on .h files
                              4. Compile for your current kit (in our case, Windows 7 64 MSVC 2015 Community Edition 64 bits Qt 5.12.2)
                              5. Copy the .h files and lib directory to your local lib path
                              6. Add the following code to your .pro file (correct the relative routes if necessary)
                              win32:CONFIG(release, debug|release): LIBS += -L$$PWD/mqtt/lib/ -lQt5Mqtt
                              else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/mqtt/lib/ -lQt5Mqttd
                              INCLUDEPATH += $$PWD/mqtt/src
                              DEPENDPATH += $$PWD/mqtt/src
                              win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/mqtt/lib/Qt5Mqtt.lib
                              else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/mqtt/lib/Qt5Mqttd.lib
                              
                              1. In your code, you can include the library classes as follow:
                              #include <qmqttclient.h>
                              

                              http://reparacionplotter.com

                              1 Reply Last reply
                              0
                              • A Offline
                                A Offline
                                autoantwort
                                wrote on 23 Apr 2020, 17:54 last edited by
                                #14

                                I tried the same but I got the error:

                                $ make
                                cd src/ && ( test -e Makefile || C:/Qt/5.14.2/mingw73_64/bin/qmake.exe -o Makefile "C:/Users/Leander Schulten/git_projects/Lichtsteuerung.git/src/lib/qtmqtt/mqtt/src/src.pro" ) && make -f Makefile
                                make[1]: Entering directory '/c/Users/Leander Schulten/git_projects/Lichtsteuerung.git/src/lib/qtmqtt/mqtt/src'
                                cd mqtt/ && ( test -e Makefile || C:/Qt/5.14.2/mingw73_64/bin/qmake.exe -o Makefile "C:/Users/Leander Schulten/git_projects/Lichtsteuerung.git/src/lib/qtmqtt/mqtt/src/mqtt/mqtt.pro" ) && make -f Makefile
                                Could not find a sync.profile for 'C:/Users/Leander'
                                Project MESSAGE: perl -w C:\Qt\5.14.2\mingw73_64\bin\syncqt.pl -module QtMqtt -version 5.14.2 -outdir "C:/Users/Leander Schulten/git_projects/Lichtsteuerung.git/src/lib/qtmqtt/mqtt" -builddir "C:/Users/Leander Schulten/git_projects/Lichtsteuerung.git/src/lib/qtmqtt/mqtt" C:/Users/Leander Schulten/git_projects/Lichtsteuerung.git/src/lib/qtmqtt/mqtt
                                Project ERROR: Failed to run: perl -w C:\Qt\5.14.2\mingw73_64\bin\syncqt.pl -module QtMqtt -version 5.14.2 -outdir "C:/Users/Leander Schulten/git_projects/Lichtsteuerung.git/src/lib/qtmqtt/mqtt" -builddir "C:/Users/Leander Schulten/git_projects/Lichtsteuerung.git/src/lib/qtmqtt/mqtt" C:/Users/Leander Schulten/git_projects/Lichtsteuerung.git/src/lib/qtmqtt/mqtt
                                make[1]: *** [Makefile:50: sub-mqtt-make_first] Error 3
                                make[1]: Leaving directory '/c/Users/Leander Schulten/git_projects/Lichtsteuerung.git/src/lib/qtmqtt/mqtt/src'
                                make: *** [Makefile:52: sub-src-make_first] Error 2
                                

                                My username contains a space and this created a problem as you can see here: Could not find a sync.profile for 'C:/Users/Leander' <- should be 'Leander Schulten'

                                Pablo J. RoginaP 1 Reply Last reply 23 Apr 2020, 18:23
                                0
                                • A autoantwort
                                  23 Apr 2020, 17:54

                                  I tried the same but I got the error:

                                  $ make
                                  cd src/ && ( test -e Makefile || C:/Qt/5.14.2/mingw73_64/bin/qmake.exe -o Makefile "C:/Users/Leander Schulten/git_projects/Lichtsteuerung.git/src/lib/qtmqtt/mqtt/src/src.pro" ) && make -f Makefile
                                  make[1]: Entering directory '/c/Users/Leander Schulten/git_projects/Lichtsteuerung.git/src/lib/qtmqtt/mqtt/src'
                                  cd mqtt/ && ( test -e Makefile || C:/Qt/5.14.2/mingw73_64/bin/qmake.exe -o Makefile "C:/Users/Leander Schulten/git_projects/Lichtsteuerung.git/src/lib/qtmqtt/mqtt/src/mqtt/mqtt.pro" ) && make -f Makefile
                                  Could not find a sync.profile for 'C:/Users/Leander'
                                  Project MESSAGE: perl -w C:\Qt\5.14.2\mingw73_64\bin\syncqt.pl -module QtMqtt -version 5.14.2 -outdir "C:/Users/Leander Schulten/git_projects/Lichtsteuerung.git/src/lib/qtmqtt/mqtt" -builddir "C:/Users/Leander Schulten/git_projects/Lichtsteuerung.git/src/lib/qtmqtt/mqtt" C:/Users/Leander Schulten/git_projects/Lichtsteuerung.git/src/lib/qtmqtt/mqtt
                                  Project ERROR: Failed to run: perl -w C:\Qt\5.14.2\mingw73_64\bin\syncqt.pl -module QtMqtt -version 5.14.2 -outdir "C:/Users/Leander Schulten/git_projects/Lichtsteuerung.git/src/lib/qtmqtt/mqtt" -builddir "C:/Users/Leander Schulten/git_projects/Lichtsteuerung.git/src/lib/qtmqtt/mqtt" C:/Users/Leander Schulten/git_projects/Lichtsteuerung.git/src/lib/qtmqtt/mqtt
                                  make[1]: *** [Makefile:50: sub-mqtt-make_first] Error 3
                                  make[1]: Leaving directory '/c/Users/Leander Schulten/git_projects/Lichtsteuerung.git/src/lib/qtmqtt/mqtt/src'
                                  make: *** [Makefile:52: sub-src-make_first] Error 2
                                  

                                  My username contains a space and this created a problem as you can see here: Could not find a sync.profile for 'C:/Users/Leander' <- should be 'Leander Schulten'

                                  Pablo J. RoginaP Offline
                                  Pablo J. RoginaP Offline
                                  Pablo J. Rogina
                                  wrote on 23 Apr 2020, 18:23 last edited by
                                  #15

                                  @autoantwort said in How can I use the QtMqtt code?:

                                  My username contains a space and this created a problem

                                  Avoid the problem using a path without spaces in it...

                                  Upvote the answer(s) that helped you solve the issue
                                  Use "Topic Tools" button to mark your post as Solved
                                  Add screenshots via postimage.org
                                  Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                                  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