Undefined reference to qt_version_tag
I am using
Qt Creator 4.0.3 Based on Qt 5.7.0 (GCC 4.9.1 20140922 (Red Hat 4.9.1-10), 64 bit)
Linux Ubuntu 16.04
When I include boost libraries in .pro file as follows:
LIBS += -L"/usr/lib/x86_64-linux-gnu" -lboost_system
I am receiving the following error:
(.qtversion[qt_version_tag]+0x0):-1: error: undefined reference to `qt_version_tag'
Please let me know if there is any way to solve this issue.Thanks in Advance...!!!
Hi! Do you use the boost library and Qt libraries from your distro? Or did you install Qt via its own online installer and compiled boost yourself?
I am using boost from distro and qt from online
I tried to compile boost from online to the latest version 1.61 but they are in the separate folder. When i check in terminal : dpkg -S /usr/include/boost/version.hpp
Ohhhh Strange!!!! Check this:
QMake version 3.0
Using Qt version 5.5.1 in /usr/lib/x86_64-linux-gnu
Is this causing the problem? How can i change my qmake version to online installed version of qt?
How can i change my qmake version to online installed version of qt?
Just run qmake with a fully-qualified path (depends on where you installed Qt from the online installer). For example, on one of my dev hosts:
paul@paul-XPS-13-9343:~$ qmake -v QMake version 3.0 Using Qt version 5.6.1 in /usr/lib/x86_64-linux-gnu paul@paul-XPS-13-9343:~$ ~/opt/qt/5.6/gcc_64/bin/qmake -v QMake version 3.0 Using Qt version 5.6.2 in /home/paul/opt/qt/5.6/gcc_64/lib paul@paul-XPS-13-9343:~$ ~/opt/qt/5.7/gcc_64/bin/qmake -v QMake version 3.0 Using Qt version 5.7.0 in /home/paul/opt/qt/5.7/gcc_64/lib paul@paul-XPS-13-9343:~$
So currently I can use Qt 5.6.1 (official Ubuntu package), 5.6.2 or 5.7.0 depending on which qmake I run.
Of course, you can also setup shell aliases, modify your shell's execution path order, etc. Whatever works best for you.
It works fine for the other projects.... The problem arises only when i add boost library in .pro file
I expect the problem is related to:
LIBS += -L"/usr/lib/x86_64-linux-gnu"
In this case, you're explicitly adding the path that contains Ubuntu's Qt 5.5.1 libraries, so when you run qmake from the online installer (or in this case, it looks like Qt Creator is (correctly) running it for you), you're essentially ending up with a potential Qt version clash, depending on the final order of the linker flags.
I'd start by simply removing the
-L...flag. It shouldn't be necessary (that path should already be set appropriately by the host OS's ldconfig, and I'd expect qmake to handle the final flag ordering correctly by default).
If that then results in the linker complaining about not finding libboost_system, then I'd check you host OS's ldconfig, and/or use a full-path to the libboost_system library.
Superb...!!!! Thank you...... It works now.
@Paul-Colby, Hi this line LIBS += -L"/usr/lib/x86_64-linux-gnu" is add in .pro??, i worked with cross-compiler application.
yes the LIBS += is for the .pro file
But i think it worked by removing it.
@mrjj, Hi i already add in .pro, but i have el same problem:
12:17:20: Running steps for project Imx6-Widget...
12:17:20: Configuration unchanged, skipping qmake step.
12:17:20: Starting: "/usr/bin/make"
g++ -o Imx6-Widget main.o qrc_qml.o -L/usr/lib/x86_64-linux-gnu -lQt5Quick -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -lGLESv2 -lpthread
main.o:(.qtversion[qt_version_tag]+0x0): referencia a `qt_version_tag' sin definir
Makefile:199: fallo en las instrucciones para el objetivo 'Imx6-Widget'
collect2: error: ld returned 1 exit status
make: *** [Imx6-Widget] Error 1
12:17:20: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project Imx6-Widget (kit: arm)
When executing step "Make"
12:17:20: Elapsed time: 00:00.
Any suggestions to solve it??
As I read the post above the posts above, it should not be included in this case.
It made it use wrong Qt version.
as @Paul-Colby says
"I'd start by simply removing the -L... flag. It shouldn't be necessary"
and poster says "It works now."
so it seems its not needed and should not be included.