Please nominate your Qt Champions for 2021!

Linking dynamic libraries for more architectures

  • Hi,

    now that Qt 5.12 brings support for 64bit, I would like to build 64bit releases of my app. Currently I have a dynamically loaded library added to my project like this:

    TAGLIBDIR = $$quote($$PWD/3rdparty/taglib)
    INCLUDEPATH += $$quote($${TAGLIBDIR}/include)
    LIBS += -L$$quote($${TAGLIBDIR}/lib) -ltag

    It works like this for my Linux, Windows and Anndroid builds. Mainly because the name of the Windows and Android libraries are different. But now I would like to add 64bit Windows and Android libraries which would have the same name. So I need to put them in another folder or change their names.

    What should be the correct solution? Where should be the libraries located, which names should they have and how the .pro file should be changed?

    Thank you.

  • Lifetime Qt Champion


    You can also add a suffix to your library name. But, IIRC, having 32bit and 64bit subfolders to store them is more common.

  • @SGaist And how do I distinguish which library should be used for which platform in the project file? Something like this would work?

    win32: {
        LIBS += -L$$quote($${TAGLIBDIR}/lib/x86) -ltag
    win64: {
        LIBS += -L$$quote($${TAGLIBDIR}/lib/x64) -ltag

  • Lifetime Qt Champion

    IIRC, something like:

    win32 {
        SUBFOLDER = x86
        contains(QMAKE_TARGET.arch, x86_64) {
            SUBFOLDER = x64
        LIBS += -L$$quote($${TAGLIBDIR}/lib/$$SUBFOLDER)
    LIBS +=  -ltag

Log in to reply