Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Referenced libraries in Visual Studio 2010 projects

Let's say I have a C++ Visual Studio 2010 solution with 2 projects: one main project with the program entry point and a second project with a static library (linked against the main one), that is used in other VS2010 solutions.

The static library project uses an additional third-party library (.lib). Currently, this third-party static library is set in the main project's Additional Dependencies field of the Linker -> Input section of the Property Pages, in order for the whole program to compile.

My question is, is there a way to add this dependency in the static library project itself, so I don't have to add it manually in each of the main projects from the different VS2010 solutions where the static library project is included?

Are there different ways to do this? Can I chose embed this third-party library in the .lib generated by the static library project? Is there any good practice or recommendations on doing this?

Thanks!

like image 703
brAzzi64 Avatar asked Mar 16 '26 13:03

brAzzi64


2 Answers

A static library is just like any other output of the linker - you can add additional dependencies in the 'librarian options' of your static lib project and they will be linked in as normal.

like image 61
Tom Whittock Avatar answered Mar 18 '26 03:03

Tom Whittock


Your static library project uses a third party static library. You only need to link the library when you create your static library, and your static library dont have to ship the third part with it, but just your library. Your static library embeds all the required binary parts from the third party static library to your static library.

If you are not using any of stuff from the third party library (i.e. if your static library has the functionality for all other projects require ) in other projects then you dont have to link aganist the third party static library. Just use your static libray instead.

like image 33
CodeWeed Avatar answered Mar 18 '26 03:03

CodeWeed



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!