Boost 安装及简单使用

本文详细介绍了Boost库的搭建步骤,包括下载、编译及配置环境变量等,并提供了使用Boost库中signals模块的具体示例代码。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Building of Boost:

1. Down load boost, bjam from http://www.boost.org/
2. Execute Build.bat in bjam folder to get bjam.exe
3. copy bjam.exe to the same folder as boost-build.jam (under folder "/Boost/boost_1_42_0/boost_1_42_0" in my version).
4. Open vs2009 command prompt and then execute "bjam stage --toolset=msvc-9.0 --without-python --stagedir="D:/Boost/boost_1_42_0/boost_1_42_0" link=shared runtime-link=shared threading=multi debug release". this link is to explain this command. http://tech.ddvip.com/2009-05/1242887529120322.html

 

 

Simple Using:

1. Seting additional include path to be "D:/Boost/boost_1_42_0/boost_1_42_0/".
3. Add "D:/Boost/boost_1_42_0/boost_1_42_0/lib/" to the lib dir.
4. Add "D:/Boost/boost_1_42_0/boost_1_42_0/lib/" to the system env variable "path"
5. write this line into header file to specify dynamic link. #define BOOST_DYN_LINK. Boost is using static link as default.
6. write following code to using boost::signals

 

Boost 大多数功能都是不需要编译就可以使用了, 使用 bjam.exe --show-libraries 命令可以打印出需要编译出库才能使用的模块:

The following libraries require building:
    - date_time
    - filesystem
    - function_types
    - graph
    - iostreams
    - math
    - mpi
    - program_options
    - python
    - regex
    - serialization
    - signals
    - system
    - test
    - thread
    - wave

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值