Important: Please read the Qt Code of Conduct -

Linking 3rd Party Library: Unresolved Externals

  • I am encountering a problem with linking a library and include files from an SDK into my Qt program. I'm using Qt5.3 to create a program and then linking the .lib and including the include files via the .pro file. It seems like I am able to get the library to link, but the compiler complains that there is an undefined reference.

    More specifically:

    I created a test Qt GUI program that contains a folder in the build directory as follows:

    • /3rdparty
      • include
        • IBScanUltimate.h
        • IBScanUltimateApi.h
        • IBScanUltimateApi_defs.h
        • IBScanUltimateApi_err.h
        • LinuxPort.h
      • lib
        • IBScanUltimate.lib

    The project file for Qt, which includes the library linking, is as follows:

    @INCLUDEPATH += "C:\Users\jcady_000\Documents\Git\whirl_auth\test_software\TestFingerprint\3rdparty\IBScanUltimate\include"
    INCLUDEPATH += "C:\Users\jcady_000\Documents\Git\whirl_auth\test_software\TestFingerprint\3rdparty\IBScanUltimate\lib"
    LIBS += -L"C:\Users\jcady_000\Documents\Git\whirl_auth\test_software\TestFingerprint\3rdparty\IBScanUltimate\lib" -l"IBScanUltimate"

    TEMPLATE = app

    QT += qml quick

    SOURCES += main.cpp

    RESOURCES += qml.qrc

    Additional import path used to resolve QML modules in Qt Creator's code model


    Default rules for deployment.


    The main.cpp file is as follows:

    @#include <QGuiApplication>
    #include <QQmlApplicationEngine>
    #include <QDebug>
    #include "IBScanUltimate.h"
    #include "IBScanUltimateApi.h"
    #include "IBScanUltimateApi_defs.h"
    #include "IBScanUltimateApi_err.h"

    int main(int argc, char *argv[])
    QGuiApplication app(argc, argv);

    QQmlApplicationEngine engine;
    int *pDeviceCount = 0;
    if (IBSU_GetDeviceCount(pDeviceCount) > 0)
        qDebug() << "Connnected";
        qDebug() << "Disconnected";
    return app.exec();


    On compiling, the file is linked, but it throws the following error:

    @C:\Users\jcady_000\Documents\Git\whirl_auth\test_software\TestFingerprint\main.cpp:-1: error: undefined reference to `IBSU_GetDeviceCount@4'
    collect2.exe:-1: error: error: ld returned 1 exit status@

    It seems that while the compiler can detect the header file references and link the library successfully, it cannot resolve the reference to the IBSU_GetDeviceCount (or any) function.

    Anyone have any idea what's going on or how to solve it?

    Thank you,

  • I think the problem might be that they library was compiled using Windows. Does anyone know how I can compile the library for Windows but the application for something else?

  • Lifetime Qt Champion


    What do you mean by "compile a library for Windows but the application for something else" ?

    Where does that SDK come from ? Which compiler was used ?

  • For anyone else having the same problem, I solved it.

    The library was compiled for a 64-bit version of windows. I got the 32-bit version from the maker and compiled it with MinGW 32-bit and it worked properly.

Log in to reply