Qt attempts to link library that is never referenced



  • Platform: Windows 10
    Qt: 5.9 Precompiled binaries
    Complier: Microsoft Visual Studio C++ compiler 15 (MSVC)
    Build Kit: Qt.5.9.0 for UWP 64bit (MSVC2017)

    I am getting following error while trying to compile project in QtCreator that depends on third party library (realsesne from Intel).
    Single line:

    LNK1181: cannot open input file '.........\librealsense\bin\Win32\realsense.lib'
    

    The path ........\librealsense\bin\Win32\realsense.lib is never referenced in project files.
    The only reference is made to x64 bit version of "realsense.lib"

    ........\librealsense\bin\x64\realsense.lib
    

    Like this:
    LIBS += "C:........\librealsense\bin\x64\realsense.lib"

    The Windows PATH variable does not reference the location of this library either.
    How is it possible?
    The ........\librealsense\bin\x64\realsense.lib is existing.



  • Hi, just guessing, but how did you create that subdirectory "........"?

    (Dots are allowed in directory names, but they have to be prefixed and suffixed by something else, for example A........Z)



  • The dots ..... are used to represent lengthy (but proper) Windows path. I'm simply not showing it, beacuse it is not relevant.


  • Lifetime Qt Champion

    Hi,

    Was librealsense also compiled for VS2017 ?



  • Hi, nice to see familiar face :)
    Librealsense was compiled using Visual Studio 2017 both for 64 and 32 bit target.
    Also, check first post I've updated the details of build kit (names).

    What bothers me is that qmake takes -spec msvc32 as parameter for 32 and 64 build kits. But i guess its historic stuff.


  • Lifetime Qt Champion

    The usual thing to do when linking to a library is:

    LIBS += -LC:/....../librealsense/bin/x64 -lrealsense
    


  • @SGaist said in Qt attempts to link library that is never referenced:

    LIBS += -LC:/....../librealsense/bin/x64 -lrealsense

    I've changed it - no difference.

    Btw I;m getting a warning:

    C:\\Program Files (x86)\....\MSVC\14.19.25917\bin]HostX86]x64\d.exe is used by qmake but "" is 
    configured in the kid.
    Please update your ki or choose a mkspec for qmke that matches your target platform.
    

    EDIT:
    Maybe it is important: realsense was compiled in Visual Studio, not in QtCreator (that uses visual studio compiler).


  • Lifetime Qt Champion

    No, it should not matter, Qt Creator will use the compiler matching the Qt version you installed.

    Just one thing I realised, which exact version of Qt did you install ?



  • Qt 5.9 downloaded using qt-unified-windows-x86 (online installer).
    I installed packages for UWP 32bit, UWP64 bit and 32bit MinGW

    Btw I now removed to whole building directory (manually) and rebuilded the project and it does not complain.

    I'm puzzled here, will mark it solved after a few more tests.


Log in to reply
 

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