创建静态库 Visual Studio [英] Creating a static library Visual Studio

查看:40
本文介绍了创建静态库 Visual Studio的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Visual Studio 中创建一个静态库,其中包含其他源,这些源的路径在定义的附加包含目录中.

I am trying to create a static library in Visual Studio that contains other sources which paths are in Additional Include Directories defined.

我可以毫无问题地构建和创建库,但是当我尝试在另一个库中使用它时项目,它似乎不包括在附加包含目录中定义的源,所以它没有找到在该路径中指定的源.静态库在构建时是否不包含该源?当您尝试创建静态库时,还有其他方法可以包含这些源吗?

I can build and create the library without problems, but when I try to use it in another project, it seems that it does not include the sources which are defined in Additional Include Directories, so It does not find the sources specified in that paths. Does the static library not include that sources when it is build? Is there another way to include that sources when you try to create a static library?

提前致谢

推荐答案

在静态库中定义额外的包含目录不会导致依赖项目也包含这些目录.

Having additional include directories defined in the static library will not cause dependent projects to also include those directories.

最后,静态库输出是包含准备链接的目标代码的 .lib 文件.

In the end, the static library output is the .lib file containing object code ready to be linked.

如果您需要它来解析#inludes,解决方案是还将路径添加到任何依赖项目的附加包含目录路径.

The solution is to also add the path to any dependant project's additional include directory path if you need it to resolve #inludes.

这篇关于创建静态库 Visual Studio的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆