Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Linking library into another library
Forum Updated to NodeBB v4.3 + New Features

Linking library into another library

Scheduled Pinned Locked Moved Qt Creator and other tools
4 Posts 2 Posters 2.4k 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.
  • R Offline
    R Offline
    Rexona for men
    wrote on last edited by
    #1

    Suppose I got two differenct static libraries libA and libB and libA is using libB, how can I command QMake to merge libB into libA so that I got only one lib file?

    Basically I just want to link on single lib file into my application. At the moment however, I have to link every library I'm using, wheter the usage is directly or indirectly.

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Rexona for men
      wrote on last edited by
      #2

      It seems that the following line

      @win32:LIBS += $$PWD/../lib/libSomeLib.a@

      is actually ignored in the ibrary project or at least removing it hasn't any effect. How can I force linking SomeLib into my library?

      E:
      By the way, I'm using MinGW instead of VS if this is somehow important.

      1 Reply Last reply
      0
      • K Offline
        K Offline
        koahnig
        wrote on last edited by
        #3

        I am not sure why you want to include one library into the other. In general I think it is better to have them separately.

        IIRC you cannot merge libraries by linking. But you basically merge object files by linking into one library. MinGW does not really distinguish between libs and objs as can see already by their names. So for merging I would expect that you can basically treat the library as an additional object file. That might work, I never tried.
        On the other hand if you have a library libb which should be merged with liba and libb has consists obj1, obj2 and obj3, why do you bother bring these 3 objects into one lib and then you want to merge this lib into another lib? Just add those objs right away into liba. Respectively, include the source files and simply build only one lib.

        Vote the answer(s) that helped you to solve your issue(s)

        1 Reply Last reply
        0
        • R Offline
          R Offline
          Rexona for men
          wrote on last edited by
          #4

          If I leave the libraries seperately, I have to link my application against all of them, even if they are not used by my application directly, but another library. This is so cumbersome. Additionally, why should my application bother, which other libraries I use in my main library, this doesn't make sense to me.
          I already thought about just putting the sources in, but I would prefer linking to keep my own stuff "clean" from foreign source code.

          With Visual Studios, this is actually easy, so I wondered whether the same is possible with QtCreator.

          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