Boost 库构建 - 运行时链接和链接选项之间的区别
我正在尝试使用 MSVC (VS 2010) 在 Windows 7 中构建 boost 库。
我在 bjam 命令行选项中遇到了 runtime-link 和 link 选项。我想知道它们是如何使用的以及它们之间的确切区别是什么。
构建了 Boost Regex 库,
我使用此命令行bjam --with-regexvariant=release --build-options=complete
它生成了这些文件:
1)boost_regex-vc100-mt-1_47.dll (导入库:boost_regex-vc100-mt-1_47.lib)
2)libboost_regex-vc100-mt-1_47.lib
3)libboost_regex-vc100-mt-s-1_47.lib
4)libboost_regex-vc100-s-1_47.lib
2个和3个.lib文件有什么区别?它们都是静态库。我已经阅读了 Boost 文档,但没有找到太多解释。
TIA
I'm trying to build boost libraries in Windows 7 with MSVC (VS 2010).
I have come across the options runtime-link and link in the bjam command line options. I would like to know how they are used and what is the exact difference between them.
I have built the Boost Regex library using this command line
bjam --with-regex variant=release --build-options=complete
it produced these files:
1)boost_regex-vc100-mt-1_47.dll (Import library:boost_regex-vc100-mt-1_47.lib)
2)libboost_regex-vc100-mt-1_47.lib
3)libboost_regex-vc100-mt-s-1_47.lib
4)libboost_regex-vc100-s-1_47.lib
What is the difference between 2 and 3 .lib files? Both of them are static libs. I have gone through the Boost doc but didn't find much explanation in that.
TIA
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
runtime-link
指的是编译器运行时的链接方式。也就是说,它对应于VC的多线程
与多线程DLL
选项。运行时是指使用编译器提供的标准库所需的组件。您可能在某个时候见过动态链接文件:
MSVCRTXX.DLL
(C 运行时)和MSVCPXX.DLL
(C++ 标准库)、MFCXX.DLL< /code> (MFC 核心类)。 是 LIBC 和 LICBP(有关库表,请参阅此处)。
静态对应项 您在构建 Boost 时使用的选项应与您用于客户端代码时的选项相匹配。否则,由于运行时不匹配,无论是在链接时还是在运行程序时,您都会收到错误。
在构建程序以使用动态链接运行时时,您需要包含 VC 可再发行组件部署您的应用程序时。
link
指的是如何将您的构建链接到 boost 库,无论是静态链接库还是动态链接库。runtime-link
refers to how your compiler's runtime is linked. That is, it corresponds to VC'sMultithreaded
vs.Multithreaded DLL
option. Runtime means the components required for using the standard libraries available with your compiler.You have probably seen the dynamic link files at some point:
MSVCRTXX.DLL
(C runtime) andMSVCPXX.DLL
(C++ standard library),MFCXX.DLL
(MFC core classes). The static counterparts are LIBC and LICBP (see here for the library table)The runtime-link option you use when building Boost should match the option when you're using for your client code. Otherwise you'll get errors due to mismatched runtime either at link time or upon running your program.
When building your program to use the dynamic link runtime, you need to include the VC redistributable when deploying your application.
link
refers to how the boost library your building will be linked to, either as a static or dynamic link library.