Boost libs building - difference between runtime-link and link options

一个人想着一个人 提交于 2019-12-20 10:27:27

问题


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


回答1:


runtime-link refers to how your compiler's runtime is linked. That is, it corresponds to VC's Multithreaded 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) and MSVCPXX.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.



来源:https://stackoverflow.com/questions/7508369/boost-libs-building-difference-between-runtime-link-and-link-options

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!