C++ boost usage

来源:互联网 发布:编程语言培训机构 编辑:程序博客网 时间:2024/06/07 05:27

Install BOOST

1. Build from source code

Download the new release package from boost official website

For windows, download zip or 7z format and unpack it using 7zip or winrar

For linux/mac os, download tar.gz or tar.bz2, and unpack it by these command.

tar zxf ....tar.gz -C ./ or tar jxf ...tar.bz2 -C ./

cd the boost_1_xx_x

for windows,  run bootstrap.bat to create bjam and b2

for linux/mac os, run ./bootstrap.sh to create bjam and b2

build the library for different compiler: 

for msvc

mkdir msvc # store the msvc libraries

./bjam toolset=msvc-10.0 --build-dir=msvc --build-type=complete --stagedir=msvc --with-filesystem --disablefilesystem2

for gcc

mkdir gcc # store the gcc libraries

./bjam toolset=gcc --build-dir=gcc --build-type=complete --stagedir=gcc --with-filesystem --disablefilesytem2 --layout=versioned

for darwin

mkdir darwin # store the darwin libraries

./bjam toolset=darwin --build-dir=darwin --build-type=complete --stagedir=darwin --with-filsystem --disablefilesystem2 --layout=versioned

2. Use macport to install

download the macport from officail website and then install it.

Run these command to install it.

sudo port selfupdate #update the software tree

port search boost #check whether contains boost

port info boost #check details about boost

sudo port install boost

the boost will be installed under /opt/local/include for header file, /opt/local/ilb for the library. If you want to change the path, need to build the source code using --prefix.


原创粉丝点击