日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

编译并使用boost库(win7+boost1.60+vs2013)

發布時間:2025/3/15 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 编译并使用boost库(win7+boost1.60+vs2013) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
下載boost庫

從http://www.boost.org上下載到目前最新的boost庫,快速傳送門:boost_1_60_0.zip

?

得到源代碼之后,使用vs2013的cl.exe編譯




進入到源代碼目錄中


建立編譯工具bjam.exe----需要執行bootstrap.bat



指定編譯命令

?

指定msvc版本12.0對應的是vs2013--stagedir是指定編譯后存放的目錄

[cpp] view plaincopy print?
  • bjam?stage?--toolset=msvc-12.0?--without-graph?--without-graph_parallel?--stagedir="D:\boost\boost_1_60_0\bin\vc12"?link=static?runtime-link=shared?runtime-link=static?threading=multi?debug?release??
  • bjam stage --toolset=msvc-12.0 --without-graph --without-graph_parallel --stagedir="D:\boost\boost_1_60_0\bin\vc12" link=static runtime-link=shared runtime-link=static threading=multi debug release

    稍微等一會,庫就編譯好了……


    開始使用boost

    首先需要設定文件包含目錄:

    我的boost庫解壓在D盤下


    設定庫目錄:


    然后建立我們的第一個boost項目,代碼如下:

    [cpp] view plaincopy print?
  • #include?"boost/thread.hpp"??
  • #include?"iostream"??
  • using?namespace?std;??
  • ??
  • ??
  • void?mythread()??
  • {??
  • ????cout?<<?"?hello,thread!?"?<<?endl;??
  • }??
  • ??
  • ??
  • int?_tmain(int?argc,?_TCHAR*?argv[])??
  • {??
  • ????boost::function<void()>?f(mythread);??
  • ????boost::thread?t(f);??
  • ????t.join();??
  • ????cout?<<?"?thread?is?over!?"?<<?endl;??
  • ??
  • ??
  • ????return?0;??
  • }??
  • #include "boost/thread.hpp" #include "iostream" using namespace std;void mythread() {cout << " hello,thread! " << endl; }int _tmain(int argc, _TCHAR* argv[]) {boost::function<void()> f(mythread);boost::thread t(f);t.join();cout << " thread is over! " << endl;return 0; }

    這是輸出

    新人創作打卡挑戰賽發博客就能抽獎!定制產品紅包拿不停!

    總結

    以上是生活随笔為你收集整理的编译并使用boost库(win7+boost1.60+vs2013)的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。