Visual Studio 2010 项目中引用的库

发布于 2025-01-02 13:26:40 字数 413 浏览 3 评论 0原文

假设我有一个包含 2 个项目的 C++ Visual Studio 2010 解决方案:一个带有程序入口点的主项目和一个带有静态库的第二个项目(与主项目链接) ),在其他 VS2010 解决方案中使用。

静态库项目使用额外的第三方库(.lib)。目前,这个第三方静态库是在链接器的主项目的附加依赖项字段中设置的 ->属性页的输入部分,以便编译整个程序。

我的问题是,有没有办法在静态库项目本身中添加此依赖项,这样我就不必在每个主项目中手动添加它包含静态库项目的不同VS2010解决方案?

有不同的方法可以做到这一点吗?我可以选择将此第三方库嵌入到静态库项目生成的.lib中吗?这样做有什么好的做法或建议吗?

谢谢!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小嗲 2025-01-09 13:26:40

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

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.

我的痛♀有谁懂 2025-01-09 13:26:40

您的静态库项目使用第三方静态库。您只需要在创建静态库时链接该库,并且您的静态库不必附带第三部分,而只需附带您的库即可。您的静态库将第三方静态库中所有必需的二进制部分嵌入到您的静态库中。

如果您没有在其他项目中使用第三方库中的任何内容(即,如果您的静态库具有所有其他项目所需的功能),那么您不必链接第三方静态库。只需使用您的静态库即可。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文