无需手动为Boost指定输入库.如何实现的? [英] No need to manually specify input libs for Boost. How is this achieved?

查看:60
本文介绍了无需手动为Boost指定输入库.如何实现的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual C ++中使用Boost时,您可以简单地包含标头,而不必费心指定要链接的输入库.在构建时,IDE将以某种方式找出要链接的适当库,无论是发布还是调试,静态链接到CRT或动态链接到CRT.这使得使用Boost非常方便.我想知道这是如何实现的.例如,使用多线程调试DLL(/MDd)配置,将选择lib libboost_system-vc80-mt-gd-1_53.lib并自动链接到该链接.

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.

推荐答案

VC ++编译器具有一项功能,使您可以指定库以使用pragma指令(

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使用此功能,如您在中所见该文件.

Boost makes use of this feature, as you can see in this file.

这篇关于无需手动为Boost指定输入库.如何实现的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆