Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. [solved] QXmpp - problem with undefined reference to
Forum Updated to NodeBB v4.3 + New Features

[solved] QXmpp - problem with undefined reference to

Scheduled Pinned Locked Moved Installation and Deployment
10 Posts 2 Posters 2.5k Views 1 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.
  • N Offline
    N Offline
    never_ever
    wrote on last edited by
    #1

    Hi,
    I try to use qxmpp library in my project (I don't want static linking), but while building there are some problems with this library: "undefined reference to...".
    I'm not sure if I do everything properly.
    I build qmpp library using Qt Creator as it was wrote in readme file.
    And I get build-qxmpp folder with builded library. Next I write:
    @
    INCLUDEPATH +=-L./build-qxmpp/src
    LIBS += qxmpp/src/base
    qxmpp/src/client
    qxmpp/src/server
    @

    And when I start to build my project the problem shows up.

    I saw common topic on forum, but there were advices to static linking, that I don't want to.
    Could you explain me where I do something wrong? Maybe I link wrong or my project is builded wrong.

    If you need any information please ask, I wish to solve this problem quick :D

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

      Hi,

      First thing I can see you have mixed these two statements:
      INCLUDEPATH is where you give the path to the headers
      LIBS is where you give the path to the libraries you link to and the libs themselves e.g.

      @LIBS += -Lpath_to_your_library -llibraryname_without_the_lib_prefix@

      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
      • N Offline
        N Offline
        never_ever
        wrote on last edited by
        #3

        Sorry, wrong rewrite (I'm little bit tired)
        Of course I have:
        @
        LIBS +=-L./build-qxmpp/src
        INCLUDEPATH += qxmpp/src/base
        qxmpp/src/client
        qxmpp/src/server

        @

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

          You are still missing the -l with the library name

          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
          • N Offline
            N Offline
            never_ever
            wrote on last edited by
            #5

            Ok, now I hav also -lqxmpp0
            But know it shows
            "cannot find -lqxmpp0"

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

              probably because:

              @-L./build-qxmpp/src@

              doesn't point to the right place. As a quick fix, give the full path to the folder containing the lib. You can then later add some logic to get it from the build dir.

              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
              • N Offline
                N Offline
                never_ever
                wrote on last edited by
                #7

                I gave the full path to the library, but now it says:
                " cannot find C:... : Permission denied".
                But this folder exist, so I do not know why it cannot find it.

                1 Reply Last reply
                0
                • N Offline
                  N Offline
                  never_ever
                  wrote on last edited by
                  #8

                  Ok, Now it works with full path to the library. Everything because of using forward slash instead of backslash. I checked it and instead of writing:

                  @-Lbuild-qxmpp/src@
                  I use:
                  @-Lbuild-qxmpp\src@

                  Thanks for help :D

                  1 Reply Last reply
                  0
                  • N Offline
                    N Offline
                    never_ever
                    wrote on last edited by
                    #9

                    I'm doing everything too fast. I have one more problem
                    When I build/re-build project it works with:
                    @-Lbuild-qxmpp\src@
                    But when I compile it, it doesn't work with it, it works only if I use full path
                    This is very strange.

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

                      That's strange. Qt uses unix style forward slashes everywhere so it should work out of the box. Do you have spaces in your path ?

                      build-qxmpp/src is a relative path. So depending on where the rest of your code is compiled, it can't be found at linking time

                      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

                      • Login

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