Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Linking 3rd Party Library: Unresolved Externals

Linking 3rd Party Library: Unresolved Externals

Scheduled Pinned Locked Moved 3rd Party Software
4 Posts 2 Posters 2.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    WickedOne612
    wrote on last edited by
    #1

    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

    QML_IMPORT_PATH =

    Default rules for deployment.

    include(deployment.pri)@

    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;
    
    engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
    
    int *pDeviceCount = 0;
    if (IBSU_GetDeviceCount(pDeviceCount) > 0)
    {
        qDebug() << "Connnected";
    }
    else
    {
        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,
    Jay

    1 Reply Last reply
    0
    • W Offline
      W Offline
      WickedOne612
      wrote on last edited by
      #2

      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?

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        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 ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • W Offline
          W Offline
          WickedOne612
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved