简体   繁体   English

将静态库链接到类库项目

[英]Linking static library to a class library project

I have a static library with .lib extension. 我有一个扩展名为.lib的静态库。 Now, I want to link this library to a class library project in Microsoft Visual Studio 10 and use the functions in my class library project. 现在,我想将此库链接到Microsoft Visual Studio 10中的类库项目,并使用我的类库项目中的功能。 I add the path of .lib file to my class library project by using properties->linker-> additional library directories, but still I can't include the headers in .lib file. 我通过使用properties-> linker->其他库目录将.lib文件的路径添加到类库项目中,但是仍然无法在.lib文件中包含标头。 It says "No such a file or directory..." So, how can I solve this problem? 它说“没有这样的文件或目录...”那么,如何解决这个问题? Thanks in advance... 提前致谢...

This error is a compilation error. 此错误是编译错误。 You need to include the .h file in Properties->C\\C++->General->Aditional include directories. 您需要在Properties-> C \\ C ++-> General-> Aditional include目录中包括.h文件。 After that compilation will pass but you will have a linking error. 之后,编译将通过,但是您将出现链接错误。 For that you will go to the option properties->linker-> additional library directories and you will specify a folder with libraries. 为此,您将转到选项属性->链接器->其他库目录,然后将指定一个包含库的文件夹。 Then go to properties->Linker->Input->Additional dependencies and there specify the .lib file you want from that folder. 然后转到properties-> Linker-> Input-> Additional依赖项,然后从该文件夹中指定所需的.lib文件。 In there you can also add abosulte path without adding to the other option i think. 在这里,您还可以添加abosulte路径,而无需添加我认为的其他选项。 Dont know why they have two places for that... 不知道为什么他们有两个地方...

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

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