boost庫是乙個功能強大,構造精巧,跨平台,開源並且完全免費的c++程式庫,
它作為標準庫的後備,是c++標準化程序的發動機之一,
在linux安裝過程如下:
$ tar -jxvf boost_1_60_0.tar.bz2
$ cd boost_1_60_0/
$ sudo ./bootstrap.sh
1. 只編譯不安裝使用下面的命令
$ ./b2
......updated 1134 targets...
the boost c++ libraries were successfully built!
the following directory should be added to compiler include paths:
/opt/cpp_practice/boost/boost_1_60_0
the following directory should be added to linker library paths:
/opt/cpp_practice/boost/boost_1_60_0/stage/lib
2. 編譯並安裝則用下面的命令:
$ ./b2 install
如果像上面這樣不指定額外選項,boost將編譯release版本的庫檔案,
把頭檔案安裝到 /usr/local/include,庫檔案安裝到 /usr/local/lib。
3. 也可以完整編譯並安裝
$ ./b2 --buildtype=complete install
這樣會對boost進行完整編譯,安裝所有除錯版,發行版的靜態庫和動態庫。
4. 定製化的編譯和安裝
執行命令:
$ ./b2 --show-libraries
可檢視所有必須編譯才能使用的庫
在完全編譯命令的基礎上,使用--with或 --without選擇可開啟或關閉某個庫的編譯,
如:$ ./b2 --with-date_time --buildtype=complete install
則將僅編譯和安裝date_time庫
二,驗證開發環境
1. 測試**
$ cat test_boost.cpp
#include
#include
#include
#include
using namespace std;
int main()
2.編譯,執行
$ g++ -wall -o test_boost test_boost.cpp
$ ls
test_boost test_boost.cpp
$ ./test_boost
123456
123.456
Linux下編譯安裝BOOST
linux平台下要編譯安裝除gcc和gcc c 之外,還需要兩個開發庫 bzip2 devel 和python devel,因此在安裝前應該先保證這兩個庫已經安裝 yum install gcc gcc c bzip2 bzip2 devel bzip2 libs python devel y ta...
Linux下編譯安裝BOOST
linux平台下要編譯安裝除gcc和gcc c 之外,還需要兩個開發庫 bzip2 devel 和python devel,因此在安裝前應該先保證這兩個庫已經安裝 yum install gcc gcc c bzip2 bzip2 devel bzip2 libs python devel y 進入...
Linux下boost庫的安裝
最近由於編譯乙個程式用到了c 的boost庫,所以便安裝了這個庫。但是,其中遇到了一些小問題。所以記錄下來,以供別人參考。首先說一下我的環境 ubuntu 12.04 32bit,gcc 4.6.3 其實在ubuntu下,可以用一下命令直接安裝 sudo apt get install libboo...