Boost C++ 标准库

Summary: Author: 张亚飞 | 阅读时间: 1 minute read | Published: 2015-03-29
Filed under Categories: C++Tags: Boost, C++,

Boost C++ 标准库

编译安装boost前,得先安装gcc,使用 sudo apt install build-essential 即可. build-essential依赖于下面这些软件包,所以安装build-essential时,这些软件也会被安装,很方便.

libc6-dev libc6-dev gcc g++ make dpkg-dev
sudo apt install build-essential
sudo apt install mpi-default-dev libicu-dev python-dev python3-dev libbz2-dev zlib1g-dev
#sudo apt install build-essential g++ python-dev autotools-dev libicu-dev build-essential libbz2-dev libboost-all-dev

cd /opt/data
wget http://nchc.dl.sourceforge.net/project/boost/boost/1.64.0/boost_1_64_0.tar.gz
tar -zxvf boost_1_64_0.tar.gz
cd boost_1_64_0
	
./bootstrap.sh
	
###./b2 install --build-type=complete --layout=versioned threading=multi --prefix="/usr/lib/boost-1.64"
sudo ./b2 install

编译安装完成后,会把boost头文件拷贝到 /usr/local/include/ 目录下,库文件在 /usr/local/lib/ 下

  • 编译安装出现问题
libs/iostreams/src/bzip2.cpp:20:56: fatal error: bzlib.h: No such file or directory

则需要安装 libbz2-dev

sudo apt install libbz2-dev

最简单的安装方式 - 不推荐

sudo apt install --no-install-recommends libboost-all-dev

cd /opt/data
wget http://www.mpich.org/static/downloads/3.2/mpich-3.2.tar.gz
tar zxf mpich-3.2.tar.gz
cd mpich-3.2
./configure --disable-fortran
make -j4
sudo make install

Comments

Cor-Ethan, the beverage → www.iirii.com