简体   繁体   English

从多个目录创建一个库文件

[英]Create a single library file from several

I need to build some library (let's call it library A ) in my project. 我需要在项目中构建一些库(我们称其为库A )。 That library depends on several other libraries. 该库依赖于其他几个库。 When I build it I have a .dll and .lib files. 构建它时,我有一个.dll和.lib文件。 Now when I try to use it, I need to include A 's headers, add newly created .lib and .dll to project. 现在,当我尝试使用它时,我需要包括A的标头,并将新创建的.lib和.dll添加到项目中。 Moreover I need to add other .libs and .dlls. 此外,我需要添加其他.libs和.dlls。 One of that libraries is Boost. 该库之一是Boost。

Is it possible to have as few files as possible? 是否可以拥有尽可能少的文件? I don't want other team members to download Boost and build it in order to compile my code. 我不希望其他团队成员下载Boost并进行构建以编译我的代码。 I just want to add one single library and header from A . 我只想从A添加一个库和标头。

You should try to use as much as you can static libraries then - they will only include the code you need and won't create DLL dependencies from your DLL. 然后,您应该尝试使用尽可能多的静态库-它们将仅包含所需的代码,并且不会从DLL中创建DLL依赖项。 This is not a good idea however because in this way your users won't be able to benefit from future libraries updates - as replacing dependant DLL's. 但是,这不是一个好主意,因为这样一来,您的用户将无法从将来的库更新中受益-替换依赖的DLL。

About the .lib files - your users will only need 1 of them which will expose your DLL functionality. 关于.lib文件-您的用户只需要其中的1个即可公开您的DLL功能。 The libs you used to create it are not needed. 不需要用于创建它的库。

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

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