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. Adding libudev & tinyxml libraries to my QT compiler
QtWS25 Last Chance

Adding libudev & tinyxml libraries to my QT compiler

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 4 Posters 1.2k 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.
  • U Offline
    U Offline
    user614
    wrote on last edited by
    #1

    I've been searching everywhere on how to do this and kind of getting frustrated because nothing seems to work.

    I am working with QT 5.5.1 on Ubuntu 16.04.5 LTS
    I have downloaded tinyxml online, and installed libudev-dev from my terminal. When I try to use either of these libraries, it gives me undefined reference to 'blah blah' which are classes that are in the headerfiles. I found a lot of posts telling me to link the library to my project, but when I run something like:~projectname$ gcc -Wall -o main main.cpp -ludev, it gives me
    fata error:QCoreApplication: No such file or directory. Is there a simple and effective way to link the libraries to my project?

    test.pro
    QT += core
    QT -= gui
    QT += widgets

    TARGET = test
    CONFIG += console
    CONFIG += qt
    CONFIG -= app_bundle

    LIBS += -l/usr/lib/arm-linux-gnueabihf/libtinyxml.a
    TEMPLATE = app

    SOURCES += main.cpp

    Also, everything I change something on my .pro file, my QT compiler outputs: /usr/lib/distcc/bin/g++-5:command not found.

    Then I have to go to my Makefile and change CC & CXX from /usr/lib/distcc/bin/gcc-t to just gcc-5 & g++-5 and then it works. Are there any other settings I have to change in order for my compiler to do this automatically so I don't have to keep changing this every time I try to link something.

    1 Reply Last reply
    0
    • U Offline
      U Offline
      user614
      wrote on last edited by
      #4

      Got it.
      I added

      CONFIG += link_pkgconfig
      DEFINES += LINK_LIBUDEV
      PKGCONFIG += libudev

      to my .pro file and it works now.

      Pablo J. RoginaP 1 Reply Last reply
      2
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Hi,

        Are you cross-compiling your application ?
        Are you building your application on an ARM machine ?

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

          @SGaist I am building my application on an ARM machine (armv7l). I've been able to compile other console applications with different libraries, but these two seem to be giving me problems.
          I'm new here so I had to wait 10 minutes lol

          1 Reply Last reply
          0
          • U Offline
            U Offline
            user614
            wrote on last edited by
            #4

            Got it.
            I added

            CONFIG += link_pkgconfig
            DEFINES += LINK_LIBUDEV
            PKGCONFIG += libudev

            to my .pro file and it works now.

            Pablo J. RoginaP 1 Reply Last reply
            2
            • JohanSoloJ Offline
              JohanSoloJ Offline
              JohanSolo
              wrote on last edited by
              #5

              If I may add my two cents, since you're using QtCore, why not using QXmlStreamReader? I had experience with tinyxml: the whole data is loaded (which was a problem for me) and the syntax is very close to C... This would save you from importing / compiling a new library.

              `They did not know it was impossible, so they did it.'
              -- Mark Twain

              1 Reply Last reply
              1
              • U user614

                Got it.
                I added

                CONFIG += link_pkgconfig
                DEFINES += LINK_LIBUDEV
                PKGCONFIG += libudev

                to my .pro file and it works now.

                Pablo J. RoginaP Offline
                Pablo J. RoginaP Offline
                Pablo J. Rogina
                wrote on last edited by
                #6

                @user614 glad you found the solution. So if your issue is solved, please mark your post as such!. Thanks.

                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