Undefined reference to qt_version_tag



  • Hi,

    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
    Boost 1.58.0

    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
    libboost1.58-dev:amd64: /usr/include/boost/version.hpp

    Ohhhh Strange!!!! Check this:
    qmake --version
    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?



  • @ghkraju said in Undefined reference to qt_version_tag:

    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.

    Cheers.



  • 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.

    Cheers.



  • 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.


  • Qt Champions 2016

    @Alexander-9
    Hi
    yes the LIBS += is for the .pro file

    http://doc.qt.io/qt-5/qmake-variable-reference.html#libs

    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??


  • Qt Champions 2016

    @Alexander-9
    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.



  • Hi,
    I am cross-compiling for Toradex apalis-tk1. I have that same problem. Can you help with this?

    ~$ qmake -v
    QMake version 3.0
    Using Qt version 5.2.1 in /usr/lib/x86_64-linux-gnu
    ~$ ~/toradex-sdk/sysroots/x86_64-angstromsdk-linux/usr/bin/qt5/qmake -v
    QMake version 3.0
    Using Qt version 5.7.1 in /home/abdullah/toradex-sdk/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/lib
    
    
    11:41:53: Running steps for project testQmake...
    11:41:53: Configuration unchanged, skipping qmake step.
    11:41:53: Starting: "/usr/bin/make" 
    /home/abdullah/toradex-sdk/sysroots/x86_64-angstromsdk-linux/usr/bin/qt5/qmake -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug -o Makefile ../testQmake/testQmake.pro
    g++  -o testQmake main.o qrc_qml.o   -L/home/abdullah/toradex-sdk/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/lib -lQt5Quick -L/home/abdullah/toradex/oe-core/build/tmp-glibc/sysroots/apalis-tk1/usr/lib/arm-linux-gnueabihf/tegra -L/home/abdullah/toradex/oe-core/build/tmp-glibc/sysroots/apalis-tk1/usr/lib -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -lGL -lpthread 
    /usr/bin/ld: skipping incompatible /home/abdullah/toradex-sdk/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/lib/libQt5Quick.so when searching for -lQt5Quick
    /usr/bin/ld: skipping incompatible /home/abdullah/toradex/oe-core/build/tmp-glibc/sysroots/apalis-tk1/usr/lib/libQt5Quick.so when searching for -lQt5Quick
    /usr/bin/ld: skipping incompatible /home/abdullah/toradex-sdk/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/lib/libQt5Gui.so when searching for -lQt5Gui
    /usr/bin/ld: skipping incompatible /home/abdullah/toradex/oe-core/build/tmp-glibc/sysroots/apalis-tk1/usr/lib/libQt5Gui.so when searching for -lQt5Gui
    /usr/bin/ld: skipping incompatible /home/abdullah/toradex-sdk/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/lib/libQt5Qml.so when searching for -lQt5Qml
    /usr/bin/ld: skipping incompatible /home/abdullah/toradex/oe-core/build/tmp-glibc/sysroots/apalis-tk1/usr/lib/libQt5Qml.so when searching for -lQt5Qml
    /usr/bin/ld: skipping incompatible /home/abdullah/toradex-sdk/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/lib/libQt5Network.so when searching for -lQt5Network
    /usr/bin/ld: skipping incompatible /home/abdullah/toradex/oe-core/build/tmp-glibc/sysroots/apalis-tk1/usr/lib/libQt5Network.so when searching for -lQt5Network
    /usr/bin/ld: skipping incompatible /home/abdullah/toradex-sdk/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/lib/libQt5Core.so when searching for -lQt5Core
    /usr/bin/ld: skipping incompatible /home/abdullah/toradex/oe-core/build/tmp-glibc/sysroots/apalis-tk1/usr/lib/libQt5Core.so when searching for -lQt5Core
    /usr/bin/ld: skipping incompatible /home/abdullah/toradex/oe-core/build/tmp-glibc/sysroots/apalis-tk1/usr/lib/libGL.so when searching for -lGL
    /usr/bin/ld: skipping incompatible /home/abdullah/toradex-sdk/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/lib/libpthread.so when searching for -lpthread
    /usr/bin/ld: skipping incompatible /home/abdullah/toradex/oe-core/build/tmp-glibc/sysroots/apalis-tk1/usr/lib/libpthread.so when searching for -lpthread
    /usr/bin/ld: skipping incompatible /home/abdullah/toradex/oe-core/build/tmp-glibc/sysroots/apalis-tk1/usr/lib/libpthread.a when searching for -lpthread
    /usr/bin/ld: skipping incompatible /home/abdullah/toradex-sdk/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/lib/libstdc++.so when searching for -lstdc++
    /usr/bin/ld: skipping incompatible /home/abdullah/toradex/oe-core/build/tmp-glibc/sysroots/apalis-tk1/usr/lib/libstdc++.so when searching for -lstdc++
    /usr/bin/ld: skipping incompatible /home/abdullah/toradex/oe-core/build/tmp-glibc/sysroots/apalis-tk1/usr/lib/libstdc++.a when searching for -lstdc++
    /usr/bin/ld: skipping incompatible /home/abdullah/toradex-sdk/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/lib/libm.so when searching for -lm
    /usr/bin/ld: skipping incompatible /home/abdullah/toradex/oe-core/build/tmp-glibc/sysroots/apalis-tk1/usr/lib/libm.so when searching for -lm
    /usr/bin/ld: skipping incompatible /home/abdullah/toradex/oe-core/build/tmp-glibc/sysroots/apalis-tk1/usr/lib/libm.a when searching for -lm
    /usr/bin/ld: skipping incompatible /home/abdullah/toradex-sdk/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/lib/libc.so when searching for -lc
    /usr/bin/ld: skipping incompatible /home/abdullah/toradex/oe-core/build/tmp-glibc/sysroots/apalis-tk1/usr/lib/libc.so when searching for -lc
    /usr/bin/ld: skipping incompatible /home/abdullah/toradex/oe-core/build/tmp-glibc/sysroots/apalis-tk1/usr/lib/libc.a when searching for -lc
    main.o:(.qtversion[qt_version_tag]+0x0): undefined reference to `qt_version_tag'
    collect2: error: ld returned 1 exit status
    make: *** [testQmake] Error 1
    11:41:53: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project testQmake (kit: TK1)
    When executing step "Make"
    11:41:53: Elapsed time: 00:00.
    

    When I add LIBS += -L"/usr/lib/x86_64-linux-gnu" to the Pro file.

    11:46:45: Running steps for project testQmake...
    11:46:45: Configuration unchanged, skipping qmake step.
    11:46:45: Starting: "/usr/bin/make" 
    /home/abdullah/toradex-sdk/sysroots/x86_64-angstromsdk-linux/usr/bin/qt5/qmake -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug -o Makefile ../testQmake/testQmake.pro
    g++  -o testQmake main.o qrc_qml.o   -L/usr/lib/x86_64-linux-gnu -L/home/abdullah/toradex-sdk/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/lib -lQt5Quick -L/usr/X11R6/lib64 -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -lGL -lpthread 
    /usr/bin/ld: skipping incompatible /home/abdullah/toradex-sdk/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/lib/libstdc++.so when searching for -lstdc++
    main.o:(.qtversion[qt_version_tag]+0x0): undefined reference to `qt_version_tag'
    collect2: error: ld returned 1 exit status
    make: *** [testQmake] Error 1
    11:46:45: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project testQmake (kit: TK1)
    When executing step "Make"
    11:46:45: Elapsed time: 00:00.
    

    Thanks.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.