Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Building a static library using Qt that statically links a 3rd party library

Building a static library using Qt that statically links a 3rd party library

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 950 Views 2 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.
  • C Offline
    C Offline
    chopper
    wrote on last edited by
    #1

    ...but even though I explicitly use the 3rd party library and have added it to the static library via LIBS += /3rd/party/library.lib - when I build the client application (a test application that uses my static library) all of the 3rd party symbols are failing to resolve unless I add "LIBS += /3rd/party/library.lib" to the client application.

    This behavior happens in Qt Creator - but presumably is entirely qmake oriented.

    This doesn't happen when I build my static library (that uses Qt) in Visual Studio - the client application only has to link to my static library and everything works well.

    BTW, the same is true for the Qt libraries as well.

    If I build my static library using Visual Studio, my client application doesn't have to link to any Qt libraries in order to build properly.

    If I build my static library using Qt Creator, my client application has to be explicitly linked to Qt libraries (like Core and Network.)

    Any suggestions?

    1 Reply Last reply
    0
    • C Offline
      C Offline
      chopper
      wrote on last edited by
      #2

      I forgot to mention, I'm using -whole-archive on the LIBS += commands.
      It seems like for static libs, qmake ignore LIBS commands entirely.

      1 Reply Last reply
      0
      • C Offline
        C Offline
        chopper
        wrote on last edited by
        #3

        If I hand edit the Makefile produced by QMAKE, I see that the LIBFLAGS entry is empty, so if I manually add:

        LIBFLAGS      = my3rdparty.lib
        

        QtCreator builds the library as I was hoping, and the client application links and runs and passes all unit tests.

        I presume that QMAKE_LFLAGS is supposed to influence that entry, but it does nothing...

        Help?

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

          Hi,

          Can you show the content of your .pro file ?
          What version of Qt are you using ?

          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

          • Login

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