win10+boost for gcc


1:Download boost from boost.org

2:unzip

3:提示:cl(ml )不是內部或外部命令

 需要在用戶環境變量Path中添加: VS目錄\vc\bin;VS目錄\vc\bin\amd64_86;VS目錄\common7\IDE;VS目錄\common7\Tools;

4:進入解壓後的目錄

 bootstrap.bat gcc

5:bjam stage --toolset=gcc --stagedir="D:\boost\boost_156_gcc" link=static runtime-link=shared runtime-link=static threading=multi --build-type=complete

6:release版本

  bjam install --toolset=borland --prefix="E:/boost_1_38_0" release --with-date_time --with-regex

  改變的是“debug”更換爲“release”。回車後開始release的boost庫編譯。
  bjam install --toolset=borland --prefix="E:/boost_1_38_0" debug(或release)--build-type=complete
    這樣會編譯出所有debug和release的lib庫。
  編譯完成後,E:/boost_1_38_0 目錄下,可以看到兩個子目錄:"include"和"lib",前者保存着所有采用純頭文件形式提供的boost代碼文件;後者則是所有編譯出的庫文件。.dll, .lib
  打開C++Builder2007.
    Project-Default Options-C++Builder設置。在Include Path添加前面的"include/boost-1_38"所在的目錄,在Library Path添加“lib”所在的目錄。
  C++Options-Paths and Directories.同上設置。

7: bjam 參數    
--build-dir=<builddir>     編譯的臨時文件會放在builddir裏(編譯完就可刪除)

       有時不知道編譯器到底需要什麼版本的lib,可以完整編譯boost:

      VC的設置衆所周知,就不說了。

--stagedir=<stagedir>     存放編譯後庫文件的路徑,默認是stage

--build-type=complete     編譯所有版本(確切地說是相當於:variant=release, threading=multi;link=shared|static;runtime-link=shared)

variant=debug|release     編譯什麼版本(Debug or Release?)

link=static|shared             使用靜態庫還是動態庫。

threading=single|multi      單線程還是多線程庫。

runtime-link=static|shared     決定是靜態還是動態鏈接C/C++標準庫。

--with-<library>     只編譯指定的庫,如輸入--with-regex就只編譯regex庫了。

--show-libraries     顯示需要編譯的庫名稱

 

用戶環境變量

Path

中添加

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章