Adding libudev & tinyxml libraries to my QT compiler
-
wrote on 29 Oct 2018, 22:50 last edited by
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 += widgetsTARGET = test
CONFIG += console
CONFIG += qt
CONFIG -= app_bundleLIBS += -l/usr/lib/arm-linux-gnueabihf/libtinyxml.a
TEMPLATE = appSOURCES += 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.
-
wrote on 29 Oct 2018, 23:54 last edited by
Got it.
I addedCONFIG += link_pkgconfig
DEFINES += LINK_LIBUDEV
PKGCONFIG += libudevto my .pro file and it works now.
-
Hi,
Are you cross-compiling your application ?
Are you building your application on an ARM machine ? -
wrote on 29 Oct 2018, 23:02 last edited by
@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 -
wrote on 29 Oct 2018, 23:54 last edited by
Got it.
I addedCONFIG += link_pkgconfig
DEFINES += LINK_LIBUDEV
PKGCONFIG += libudevto my .pro file and it works now.
-
wrote on 30 Oct 2018, 07:21 last edited by
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.
-
Got it.
I addedCONFIG += link_pkgconfig
DEFINES += LINK_LIBUDEV
PKGCONFIG += libudevto my .pro file and it works now.
wrote on 30 Oct 2018, 12:23 last edited by@user614 glad you found the solution. So if your issue is solved, please mark your post as such!. Thanks.
6/6