Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. Static lib + static libs
QtWS25 Last Chance

Static lib + static libs

Scheduled Pinned Locked Moved C++ Gurus
5 Posts 4 Posters 3.9k Views
  • 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.
  • M Offline
    M Offline
    mirswith
    wrote on last edited by
    #1

    Hi. I am creating a static lib (A) using Qt Creator and this static lib links against other static libs (B) and then I have another program that is linking against my main static lib (A) however I am getting "symbol(s) not found" errors unless I also link in the (B) libs. Shouldn't my (B) libs be linked into my (A) lib and my program should not require the additional links? This is working for me using XCode on OSX but maybe Qt Creator handles this differently?

    Any advice is greatly appreciated.

    Thanks.

    -=ben

    Moved to C++ as it's not a Qt issue

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      A static library is only a collection ob objects. They are resolved when linked to a binary.
      You can't link a static lib agains dlls or other libs.

      It's always the responsibility of the binary to get all object code together, this includes static libraries.

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mirswith
        wrote on last edited by
        #3

        Are there any utils for combining libs into a single lib for osx as well as windows?

        Thanks.

        -=ben

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          The only possibility is to explicitly incorporate the symbols of lib B into lib A. This does not work by just linking B to A, one has to use some library tools (eg. using ar on unix/linux systems). Maybe XCode does that magic automatically for you, whereas qmake with regular Makefiles does not.

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • T Offline
            T Offline
            tobias.hunger
            wrote on last edited by
            #5

            marswith: That tool is called ar. Mac, Linux and windows use this really simplistic packaging tool to store a set of object files into a static library. Of course all OSes use slightly different formats in the ar files they call static libraries;-)

            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