VC++中如何添加外部库进行编译?

我使用过几个 Visual C++ 编译器(VC97、VC2005、VC2008),但我还没有真正找到将外部库添加到我的构建中的明确方法.我来自 Java 背景,Java 库就是一切!

I've worked with a couple of Visual C++ compilers (VC97, VC2005, VC2008) and I haven't really found a clearcut way of adding external libraries to my builds. I come from a Java background, and in Java libraries are everything!

我从在我的 Linux 机器上编译开源项目了解到,该库的所有源代码似乎都需要包含在内,但那些 .so 文件除外.

I understand from compiling open-source projects on my Linux box that all the source code for the library seems to need to be included, with the exception of those .so files.

我也听说过 .lib 静态库和 .dll 动态库,但我仍然不完全确定如何将它们添加到构建中并使它们工作.这是怎么回事?

Also I've heard of the .lib static libraries and .dll dynamic libraries, but I'm still not entirely sure how to add them to a build and make them work. How does one go about this?

推荐答案

在我看来,您可能会问如何将 lib 添加到 IDE 中的项目/解决方案的机制...

In I think you might be asking the mechanics of how to add a lib to a project/solution in the IDEs...

在 2003、2005 和 2008 年,它类似于:

In 2003, 2005 and 2008 it is something similar to:

来自解决方案资源管理器 - 右键单击??项目选择属性(通常是最后一个)我通常选择顶部的所有配置...链接器输入

from the solution explorer - right click on the project select properties (typically last one) I usually select all configurations at the top... Linker Input

额外的依赖进入那里

我希望我可以为此做一个屏幕截图.

I wish I could do a screen capture for this.

在 VC6 中对我来说是不同的,因为这一切都来自记忆

In VC6 it is different bear with me as this is all from memory

项目设置或属性,然后转到链接器选项卡并找到可以添加库的位置.

project settings or properties and then go to the linker tab and find where the libs can be added.

请原谅这篇文章的随意性.我认为这就是你想要的.

Please excuse the haphazard nature of this post. I think that is what you want though.

相关文章