简体   繁体   中英

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!

静态库就像链接器的任何其他输出一样 - 您可以在静态库项目的“库管理器选项”中添加其他依赖项,它们将正常链接。

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 (ie 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM