简体   繁体   English

如何将lib文件和标头添加到C ++项目

[英]How to add lib files and headers to a C++ Project

I have been using libcurl in a C++ project. 我一直在C ++项目中使用libcurl。 I have added the libcurl Include and Library directory's to the VC++ Directories and added the .lib file to the Linkers Input Additional Dependencies. 我已经将libcurl的Include和Library目录添加到了VC ++目录中,并将.lib文件添加到了Linkers Input Additional Dependencies。

Everything works fine but when I check in my code (TFS) and somebody gets it on another machine they cannot build etc due to not having libcurl installed on their machine or installed in different paths etc. 一切正常,但是当我签入我的代码(TFS)时,由于没有在自己的计算机上安装libcurl或未在其他路径中安装libcurl,因此有人在另一台计算机上将其构建失败。

How do I add all the necessary files to my C++ Solution so that anyone getting the project from source control can build and link without error. 如何将所有必需的文件添加到我的C ++解决方案中,以便从源代码管理中获取项目的任何人都可以正确构建和链接。

Thanks 谢谢

The solution I went with was too add the library file to a folder within my solution, then add 我使用的解决方案也是将库文件添加到解决方案中的文件夹中,然后添加

$(SolutionDir)libs\curllib.lib

To the Additional Dependencies within Linker->Input 到链接器->输入中的其他依赖项

You can not add the library to the solution. 您不能将库添加到解决方案中。 you should distribute the library along the source code. 您应该沿着源代码分发该库。 Place it in a subdirectory of the project so that it goes along the whole project source. 将其放置在项目的子目录中,以便使其遍及整个项目源。 Then configure the path in Additional Library Dependencies. 然后在“其他库依赖关系”中配置路径。 That way the people should be able to link appropriately when building from source. 这样,从源构建时,人们应该能够适当地链接。

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

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