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. Some strange problem related Qt static library.
Qt 6.11 is out! See what's new in the release blog

Some strange problem related Qt static library.

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 2.3k 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.
  • M Offline
    M Offline
    mady
    wrote on last edited by
    #1

    I have created a static library using already available Qt static libraries like core/gui/network/xml, I included them in my development project and created my static library myLib.lib.

    Now I wanted to write a Qt based test app which will be using my lib but it seems I need to include all those Qt libraries again in my test app, is it correct or I missed something?
    Without including xml and network Qt libs it is giving linker error.

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

      I know that if you use the VC compiler, and "link" some static library with other third-party libraries, then there is no need for your application to be linked with those third-party libraries. If you use MinGW compiler, I think it comes in the situation you mentioned. However a static library can not be "linked" with other third-party libraries, only dynamic libraries and applications can be in the true sense in link with other libraries.

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

        But I am using Visual Studio compiler.

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lgeyer
          wrote on last edited by
          #4

          Well, when you compile something static the linker does not include all the symbols in the resulting binary, it usually just picks the ones referenced. So if your library A has references to symbols 1, 2 and 3 of library B only those are included. If your application now references symbol 4, 5 and 6 of library B, but is just linked against A (which has only 1, 2 and 3) you will get an linker error and you will have to link against library B again (so the linker can pull out symbol 4, 5 and 6).

          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