Linking library into another library
-
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.
-
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. -
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. -
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.