Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Solved how to add library(qmqtt.h) in qmqtt client for windows

    General and Desktop
    7
    59
    22124
    Loading More Posts
    • 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.
    • S
      shravani last edited by

      hi,

      i downloaded code from github for qmqtt client,but im getting error that qmqtt.h not present.
      In pro file i added the path correctly.

      raven-worx 1 Reply Last reply Reply Quote 0
      • raven-worx
        raven-worx Moderators @shravani last edited by

        @shravani
        You need to be more specific to be able to help, since this can have many causes.
        Maybe you just need to rerun qmake to update the makefiles?
        Show the directory structure and your .pro file.

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        1 Reply Last reply Reply Quote 2
        • S
          shravani last edited by shravani

          hi,
          this is my .pro file
          and my code is inthis( https://github.com/wuming123057/qmqtt-client) link.
          the library i added is https://github.com/emqtt/qmqtt

          QT += core gui network

          greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

          CONFIG += c++11
          CONFIG+= NO_UNIT_TESTS
          TARGET = qmqtt-client
          TEMPLATE = app

          #NOTICE: add DYLD_LIBRARY_PATH to build environment.
          INCLUDEPATH += C:\Qt\qmqtt-master\src
          LIBS += -LC:\Qt\qmqtt-master\src -lqmqtt

          SOURCES += main.cpp
          mainwindow.cpp
          connform.cpp
          pubform.cpp
          subform.cpp

          HEADERS += mainwindow.h
          connform.h
          pubform.h
          subform.h
          mqttform.h

          FORMS += mainwindow.ui
          connform.ui
          pubform.ui
          subform.ui

          im getting error:
          cannot find -lmqtt
          returned 1 exit status

          raven-worx 1 Reply Last reply Reply Quote 0
          • F
            Fuel last edited by

            which name has the library in this path C:\Qt\qmqtt-master\src ?

            1 Reply Last reply Reply Quote 0
            • raven-worx
              raven-worx Moderators @shravani last edited by raven-worx

              @shravani said in how to add library(qmqtt.h) in qmqtt client for windows:

              INCLUDEPATH += C:\Qt\qmqtt-master\src

              should point to the sources of qmqtt (specifically where qmqtt.h is placed in)

              LIBS += -LC:\Qt\qmqtt-master\src -lqmqtt

              Also you need to build qmqtt beforehand. -L should point to the path of the library (.lib) you built

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              S 1 Reply Last reply Reply Quote 2
              • S
                shravani last edited by shravani

                thank you,
                i will try building the qmqtt.

                1 Reply Last reply Reply Quote 1
                • S
                  shravani @raven-worx last edited by

                  @raven-worx
                  hi,
                  i tried building the library(i got "could not find executable please specify one" dialog box) there is no .dll or .lib or .so file in build folder.
                  in build it created 3 folders(.moc,.obj,.pch).could you please tell me how to generate .lib file

                  jsulm 1 Reply Last reply Reply Quote 0
                  • jsulm
                    jsulm Lifetime Qt Champion @shravani last edited by

                    @shravani Can you explain what exactly you did?

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

                    S 1 Reply Last reply Reply Quote 0
                    • S
                      shravani @jsulm last edited by shravani

                      @jsulm

                      from here https://github.com/emqtt/qmqtt i downloaded zip file.in that src/mqtt mqtt.pro i built using qt.but that library not generating any .lib files.
                      (as u told i need to build qmqtt beforehand. -L should point to the path of the library (.lib) you built.)

                      jsulm 1 Reply Last reply Reply Quote 0
                      • jsulm
                        jsulm Lifetime Qt Champion @shravani last edited by

                        @shravani What I wanted to know was: how exactly did you build? What steps did you execute?
                        "built using qt" - what does this mean? Qt does not build anything. Do you mean you used QtCreator or qmake?
                        Can you also post the build log?

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

                        S 1 Reply Last reply Reply Quote 0
                        • S
                          shravani @jsulm last edited by shravani

                          @jsulm
                          i used qt creator.i just opened .pro file (src/mqtt/mqtt.pro from above link)using qtcreator and build all.

                          jsulm 1 Reply Last reply Reply Quote 0
                          • jsulm
                            jsulm Lifetime Qt Champion @shravani last edited by

                            @shravani Can you post the build log?

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

                            S 1 Reply Last reply Reply Quote 0
                            • S
                              shravani @jsulm last edited by shravani

                              @jsulm
                              when i click on build all one dialog box came like below.but in build folder(build-abc-Desktop_Qt_5_8_1_MinGW_32bit-Debug) .lib file not generated only 3 folders(.moc, .obj , .pch) created .!!0_1498626615873_Capture.PNG

                              jsulm 1 Reply Last reply Reply Quote 0
                              • jsulm
                                jsulm Lifetime Qt Champion @shravani last edited by

                                @shravani It looks like you're clicking on Run not on Build. Since mqtt is a lib you cannot execute it. And again: can you post the build log?

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

                                S 1 Reply Last reply Reply Quote 1
                                • S
                                  shravani @jsulm last edited by shravani

                                  @jsulm
                                  sorry ,i can only post what i got after building in build folder.0_1498628025184_build_image.PNG!0_1498628076971_build.PNG

                                  jsulm raven-worx 2 Replies Last reply Reply Quote 0
                                  • jsulm
                                    jsulm Lifetime Qt Champion @shravani last edited by

                                    @shravani Why can't you post the build log? You have it in QtCreator. The screen-shots you posted do not help.

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

                                    1 Reply Last reply Reply Quote 0
                                    • raven-worx
                                      raven-worx Moderators @shravani last edited by

                                      @shravani
                                      got the folder where you donwloaded qmqtt (where the qmqtt.pro resides) and and execute the following:

                                      1. qmake
                                      2. nmake (for Visual Studio compiler) or mingw32-make (for mingw)

                                      thats it. No QtCreator needed.
                                      Then the .dll and corresponding .lib (MSVC) or .a (mingw32) file will be created in the output folder.

                                      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                                      If you have a question please use the forum so others can benefit from the solution in the future

                                      S 1 Reply Last reply Reply Quote 1
                                      • S
                                        shravani @raven-worx last edited by shravani

                                        @raven-worx
                                        thank you,
                                        im new to qt could you please tell me how to execute qmake and mingw32-make in windows?

                                        raven-worx 1 Reply Last reply Reply Quote 0
                                        • raven-worx
                                          raven-worx Moderators @shravani last edited by raven-worx

                                          @shravani
                                          open a console window and execute "qmake" let it finished and afterwards execute one of the two (the correct one corresponding to your used compiler!) make commands for building.

                                          Make sure that the executable can be found by the system (add the paths to the PATH environment variable)
                                          But those a pretty basics. Probably you should go on reading some learning material first before trying to build a software which is based on a 3rd party library.

                                          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                                          If you have a question please use the forum so others can benefit from the solution in the future

                                          S 1 Reply Last reply Reply Quote 1
                                          • S
                                            shravani @raven-worx last edited by shravani

                                            @raven-worx
                                            can u give any link to read? and where .lib will be created? in same folder?

                                            raven-worx 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post