What is the solution of this error?



  • I get this error ONLY when I use SDL Libraries.

    (.qtversion[qt_version_tag]+0x0):-1: error: undefined reference to `qt_version_tag'



  • Hi, that 'qt_version_tag' is Qt checking that it loads the correct .so files (for example the libQt5Core.so.5 that belongs to 5.7). So if you get a message about "undefined reference to qt_version_tag" that means Qt is trying to load an old/wrong dll.



  • Is there any solution If you know, please help me out!
    I am running Qt 5.7 on ubunutu



  • Hi, check that you've #included "qglobal.h" in all .cpp files. (That's where the qt_version_tag is defined.)



  • THanks but still no luck!



  • Hmm, how's the output from ldd your-app? Perhaps there's some 5.5.1 libraries in there (because Ubuntu 16.04 comes with Qt 5.5.1 pre-installed).


  • Moderators

    @hskoglund said in What is the solution of this error?:

    Hi, check that you've #included "qglobal.h" in all .cpp files. (That's where the qt_version_tag is defined.)

    Henry, you've mentioned this before, so I went on and checked. It doesn't matter whether you include <QtGlobal> as the versioning tag is generated only when Qt's compiled (which I suspected, hence the double-check ;)). See here (notice the ifdef) and here (note the extern const char * that's built with the macro). However I do believe you were right the first time and the error is popping up because of binaries that are incompatible (it was when I encountered it).

    @mit_cruze said in What is the solution of this error?:

    THanks but still no luck!

    As @hskoglund says, make sure you're not mixing up Qt builds.



  • @kshegunov Yes, you're right, I wasn't checking when/where the versioning tag is defined. Slightly confused, that error above: ... undefined reference to `qt_version_tag' is a linking error, right? But the similar error you got before, wasn't that when you tried to start you app?


  • Moderators

    @hskoglund said in What is the solution of this error?:

    Slightly confused, that error above: ... undefined reference to `qt_version_tag' is a linking error, right? But the similar error you got before, wasn't that when you tried to start you app?

    Yes I got it on loading, because I had unintentionally substituted the binaries my application is linked to.

    As for your first question:
    There's little distinction on Linux as the symbol resolution will be actually done at run-time (in contrast to Windows); and that's one big mother of a pitfall. :)


Log in to reply