root@iZ2ze4aqfcvyxgcvpjrj6iZ:~/software_installation$ ls
boost_1_69_0.tar.gz
root@iZ2ze4aqfcvyxgcvpjrj6iZ:~/software_installation$ tar -zxvf boost_1_69_0.tar.gz
root@iZ2ze4aqfcvyxgcvpjrj6iZ:~/software_installation$ ls
boost_1_69_0 boost_1_69_0.tar.gz
root@iZ2ze4aqfcvyxgcvpjrj6iZ:~/software_installation cd boost_1_69_0/
root@iZ2ze4aqfcvyxgcvpjrj6iZ:~/software_installation/boost_1_69_0$ ls
boost boostcpp.jam boost.png bootstrap.sh index.htm INSTALL libs more status
boost-build.jam boost.css bootstrap.bat doc index.html Jamroot LICENSE_1_0.txt rst.css tools
root@iZ2ze4aqfcvyxgcvpjrj6iZ:~/software_installation/boost_1_69_0$ ./bootstrap.sh
Building Boost.Build engine with toolset gcc... tools/build/src/engine/bin.linuxx86_64/b2
Unicode/ICU support for Boost.Regex?... not found.
Generating Boost.Build configuration in project-config.jam...
Bootstrapping is done. To build, run:
./b2
To adjust configuration, edit 'project-config.jam'.
Further information:
- Command line help:
./b2 --help
- Getting started guide:
http://www.boost.org/more/getting_started/unix-variants.html
- Boost.Build documentation:
http://www.boost.org/build/doc/html/index.html
root@iZ2ze4aqfcvyxgcvpjrj6iZ:~/software_installation/boost_1_69_0$ ls
b2 boost-build.jam boost.png bootstrap.sh index.html libs project-config.jam tools
bjam boostcpp.jam bootstrap.bat doc INSTALL LICENSE_1_0.txt rst.css
boost boost.css bootstrap.log index.htm Jamroot more status
root@iZ2ze4aqfcvyxgcvpjrj6iZ:~/software_installation/boost_1_69_0$ ./b2
編譯完成后,會有如下打印:
成都創新互聯主營靖安網站建設的網絡公司,主營網站建設方案,成都APP應用開發,靖安h5小程序定制開發搭建,靖安網站營銷推廣歡迎靖安等地區企業咨詢The Boost C++ Libraries were successfully built!
The following directory should be added to compiler include paths:
/home/tony/package/boost_1_69_0
The following directory should be added to linker library paths:
/home/tony/package/boost_1_69_0/stage/lib
root@iZ2ze4aqfcvyxgcvpjrj6iZ:~/software_installation# ./b2 install
安裝完成后,最后會有如下信息打印出來:
ln-UNIX /usr/local/lib/libboost_wave.so
common.copy /usr/local/lib/libboost_exception.a
common.copy /usr/local/lib/libboost_system.a
common.copy /usr/local/lib/libboost_chrono.a
common.copy /usr/local/lib/libboost_timer.a
common.copy /usr/local/lib/libboost_test_exec_monitor.a
...updated 14831 targets...
test.cpp
#include#include#includeusing namespace std;
class Hello
{public:
void say(string name)
{cout<< name<< " say: hello world!"<< endl; }
};
int main()
{Hello h;
auto func = boost::bind(&Hello::say, &h, "小呆鳥");
func();
return 0;
}
執行命令
g++ -o test test.cpp -std=c++11
./test
'結果顯示'
小呆鳥 say: hello world!
你是否還在尋找穩定的海外服務器提供商?創新互聯www.cdcxhl.cn海外機房具備T級流量清洗系統配攻擊溯源,準確流量調度確保服務器高可用性,企業級服務器適合批量采購,新人活動首月15元起,快前往官網查看詳情吧
當前題目:【C++網絡編程—linux下boost庫源碼編譯安裝】-創新互聯
瀏覽路徑:http://vcdvsql.cn/article34/hoope.html
成都網站建設公司_創新互聯,為您提供搜索引擎優化、域名注冊、網站導航、靜態網站、網站設計公司、網站內鏈
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯