Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. QMQTT undefined reference to ...
Forum Updated to NodeBB v4.3 + New Features

QMQTT undefined reference to ...

Scheduled Pinned Locked Moved Unsolved 3rd Party Software
16 Posts 3 Posters 6.1k Views 2 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.
  • A Offline
    A Offline
    Alex-Krieg
    wrote on last edited by
    #1

    625/5000
    I have a problem with the QMQTT library from https://github.com/toni1991/QtMqtt I'm trying my first with it but there's always this bug.
    Error: undefined reference to `QMQTT :: Client :: Client (QString const &, unsigned int, QObject *) '
    The library has 2 directories for source files and for header files.
    in .pro I have specified these directories as INCLUDEPATH + = ...
    I create a pointer object of a class from INCLUDEPATH, that works too.
    As soon as I create the object with new wil this error comes.
    It seems to me that QT does not find the .cpp files.

    Does anyone know why this is?

    0_1511045253468_c6d70efc-6824-4176-a5ce-36f51a8c0cc9-grafik.png
    Error:
    0_1511045294409_3e098b21-3015-427e-b2f5-e4cc2c1f0ad8-grafik.png

    Directory:
    0_1511045412628_31102cad-f955-4404-ba99-1248cd8cd97d-grafik.png

    If someone has a solution I would be very grateful for that.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Might be a silly question but are you linking your application against that module ?

      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
      • A Offline
        A Offline
        Alex-Krieg
        wrote on last edited by
        #3

        How do you mean that?
        This is the first time I want to use an external library.
        It may well be that I did not do that. How should I do that?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Link against the library generate by that project: LIBS += -lqmqtt .

          Just in case, if you'd like to remain with Qt's own framework, it now provides the QtMqtt module that you can use as any other Qt modules.

          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
          1
          • A Offline
            A Offline
            Alex-Krieg
            wrote on last edited by
            #5

            that with LIBS + = does not work.
            I understand the context not synonymous if you just -qmqtt angiel, how knows QT what needs to be done with it? Is this a path or a file or is it something?

            Do you mean with QtMqtt what is described here? http://blog.qt.io/blog/2017/08/14/introducing-qtmqtt-protocol/
            If so, I would be very happy, because I thought that it is not yet public.

            By the way, are you Swiss? =)
            I'm swiss.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Qt doesn't, the LIBS variable is where you give options to give to the linker.

              Did you build and install that project ? If so where did you install it ? You might need to give an additional path for the linker to find the library.

              I already gave you the link to the official repository in my previous answer.

              Yes I am.

              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
              2
              • A Offline
                A Offline
                Alex-Krieg
                wrote on last edited by Alex-Krieg
                #7

                Yes I have build the library.
                Location is where I have my QT projects.
                From there with the CMD I have processed the following commands:
                qmake
                make
                make install
                Where are the libraries of QT installed?
                I downloaded the library from your link and ran the same commands but there were errors.

                0_1511049553967_40e6b86f-eb31-4bd9-9c46-ddb6bad05b9b-grafik.png

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  Alex-Krieg
                  wrote on last edited by
                  #8

                  @SGaist
                  How do I have to proceed to install the library from your link?
                  I have already downloaded the zip.
                  Where do I have to unzip it and how do I build it?
                  I work under Windows 8.1 and compile with MinGW.

                  aha_1980A 1 Reply Last reply
                  0
                  • A Alex-Krieg

                    @SGaist
                    How do I have to proceed to install the library from your link?
                    I have already downloaded the zip.
                    Where do I have to unzip it and how do I build it?
                    I work under Windows 8.1 and compile with MinGW.

                    aha_1980A Offline
                    aha_1980A Offline
                    aha_1980
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    @Alex-Krieg said in QMQTT undefined reference to ...:

                    @SGaist
                    How do I have to proceed to install the library from your link?

                    If you mean QtMqtt, it does not matter where you install it. make install will copy headers, .lib and .dll to the correct position in your Qt tree.

                    Afterwards you can add QT += mqtt (I guess) in your pro file and all should be fine automatically.

                    For the other library however (if you want to use it), you need to specify the link path too:

                    LIBS += -L/path/to/lib -llibname-without-extension

                    Qt has to stay free or it will die.

                    1 Reply Last reply
                    2
                    • A Offline
                      A Offline
                      Alex-Krieg
                      wrote on last edited by
                      #10

                      @aha_1980
                      Thank you for this info but in my last Picture you can se, that I had an error during the "make" I realy downt know why. In my .pro is the "QT += qmqtt" but it says "Project ERROR: Unknown module(s) in QT: mqtt"

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        Do I read the error correctly: -std-c++1z ? That should be -std=c++1z

                        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
                        • A Offline
                          A Offline
                          Alex-Krieg
                          wrote on last edited by
                          #12

                          @SGaist its "-std=c++1z"
                          What can you say about this?
                          I really do not understand that anymore

                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #13

                            That enables C++17 support, did you trigger it somewhere ?

                            Otherwise, why not build it trough Qt Creator ? That will ensure that the build environment matches the Qt version you want to use directly.

                            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
                            1
                            • A Offline
                              A Offline
                              Alex-Krieg
                              wrote on last edited by
                              #14

                              Ok mit Qt-Creater hat es funktioniert.
                              Die Dlls und so wurden erzeugt.
                              Jetzt habe ich im Projekt auf diese Verzeichnisse verwiesen aber da kommt immer der Error: "Project ERROR: Unknown module(s) in QT: mqtt"
                              Habe ich was falsch gemacht?

                              0_1511131268078_02f50105-e8cb-4c02-9047-a767676374df-grafik.png

                              1 Reply Last reply
                              0
                              • aha_1980A Offline
                                aha_1980A Offline
                                aha_1980
                                Lifetime Qt Champion
                                wrote on last edited by
                                #15

                                @Alex-Krieg: Did you run make install after buildin QtMqtt? You can add it as build step after make in the Projects settings un Creator.

                                Qt has to stay free or it will die.

                                1 Reply Last reply
                                1
                                • A Offline
                                  A Offline
                                  Alex-Krieg
                                  wrote on last edited by
                                  #16

                                  @aha_1980 rly? you are the best.
                                  after the make install it worked. Thank you very much. I'm very happy about that now.
                                  Thanks a lot. =)

                                  1 Reply Last reply
                                  2

                                  • Login

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