When using Boost with Visual C++, you can simply include the headers without ever bothering specifying which input libs to link. At build time, the IDE will somehow figure out the appropriate libs to link, be it release or debug, statically linking to CRT or dynamically linking to CRT. This makes using Boost quite convenient. I'm wondering how this is achieved. As an example, with a Multi-threaded Debug DLL (/MDd) configuration, the lib libboost_system-vc80-mt-gd-1_53.lib
will be chosen and linked to automatically.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
The VC++ compiler has a feature that allows you to specify libraries to link directly in source code using pragma directives (https://msdn.microsoft.com/en-us/library/7f0aews7.aspx). It looks something like this:
#pragma comment(lib, "name-of-library")
Boost makes use of this feature, as you can see in this file.