简体   繁体   English

找不到我要链接的lib文件

[英]can not find my lib files to link

I am trying to find a lib file that I created. 我试图找到我创建的lib文件。 I changed the configuration type to static lib. 我将配置类型更改为静态库。 Then I rebuild the application. 然后,我重建应用程序。 When I go to the debug folder in windows, I see the .lib file. 当我进入Windows中的debug文件夹时,我看到了.lib文件。 but when I create a new application and try to add it to "additional Library Directories" I go to the exact folder and it does not show up. 但是,当我创建一个新的应用程序并尝试将其添加到“其他库目录”时,我转到了确切的文件夹,但它没有显示。

You should use Project - Linker - Input - Additional Dependencies to add your created library. 您应该使用Project - Linker - Input - Additional Dependencies项添加创建的库。 So, the directories is not what you want to change. 因此,目录不是您想要更改的目录。

There are 2 simple ways to include that lib in your new project. 有两种简单的方法可以将lib包含在新项目中。

First one - just copy this lib to your new projects folder and add it's name at the Additional Dependencies input field. 第一个-只需将此lib复制到新项目文件夹,然后在“ Additional Dependencies输入字段中添加其名称。

The second - add a new project to the same solution and set it's dependency to your first project. 第二个-将新项目添加到相同的解决方案,并将其依赖项设置为第一个项目。 This way your library will be linked automatically. 这样,您的书架将自动链接。

The AdditionalLibraryDirectories setting is for, well, directories. 另外, AdditionalLibraryDirectories设置适用于目录。 You add the directory the lib is in there, and add the lib's name to AdditionalDependencies 您添加库所在的目录,并将库的名称添加到AdditionalDependencies

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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