程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> C++ >> C++入門知識 >> Win7下Boost庫的安裝,Win7Boost庫安裝

Win7下Boost庫的安裝,Win7Boost庫安裝

編輯:C++入門知識

Win7下Boost庫的安裝,Win7Boost庫安裝


Boost庫是C++領域公認的經過千錘百煉的知名C++類庫,涉及編程中的方方面面,簡單記錄一下使用時的安裝過程

1.boost庫的下載

boost庫官網主頁:www.boost.org

2.安裝

 將下載的壓縮包解壓到指定的目錄

3.建立編譯工具bjam.exe

在源碼目錄下執行bootstrap.bat,生成bjam.exe

4.在命令行模式下利用bjam編譯boost庫,這裡利用VS2012自帶的命令行工具

D:\Program Files\VS2012\VC>cd D:\Program Files\BoostSDK\boost

D:\Program Files\BoostSDK\boost>bjam stage

D:\Program Files\BoostSDK\boost>bjam stage --toolset=msvc-11.0 --without-graph -
-without-graph_parallel --without-mpi --without-wave --stagedir="D:\Program File
s\BoostSDK\bin\vc110" link=static runtime-link=shared runtime-link=static thread
ing=multi debug release

說明:

--toolset 指明編譯工具,msvc-11.0表示Visual Studio 2012

--stagedir 指明編譯後庫文件的存放路徑

--without-mpi表示不編譯mpi庫,其他的--without類似

boost庫中有些庫是必須要編譯才能使用的,大部分只要引用頭文件即可,少數是必須編譯成二進制文件的。

摘用官方文檔的一點說明:

The first thing many people want to know is, “how do I build Boost?” The good news is that often, there's nothing to build.

Nothing to Build?

Most Boost libraries are header-only: they consist entirely of header files containing templates and inline functions, and require no separately-compiled library binaries or special treatment when linking.

The only Boost libraries that must be built separately are:

  • Boost.Chrono
  • Boost.Context
  • Boost.Filesystem
  • Boost.GraphParallel
  • Boost.IOStreams
  • Boost.Locale
  • Boost.MPI
  • Boost.ProgramOptions
  • Boost.Python (see the Boost.Python build documentation before building and installing it)
  • Boost.Regex
  • Boost.Serialization
  • Boost.Signals
  • Boost.System
  • Boost.Thread
  • Boost.Timer
  • Boost.Wave

A few libraries have optional separately-compiled binaries:

  • Boost.DateTime has a binary component that is only needed if you're using its to_string/from_string or serialization features, or if you're targeting Visual C++ 6.x or Borland.
  • Boost.Graph also has a binary component that is only needed if you intend to parse GraphViz files.
  • Boost.Math has binary components for the TR1 and C99 cmath functions.
  • Boost.Random has a binary component which is only needed if you're using random_device.
  • Boost.Test can be used in “header-only” or “separately compiled” mode, although separate compilation is recommended for serious use.
  • Boost.Exception provides non-intrusive implementation of exception_ptr for 32-bit _MSC_VER==1310 and _MSC_VER==1400 which requires a separately-compiled binary. This is enabled by #define BOOST_ENABLE_NON_INTRUSIVE_EXCEPTION_PTR.

5.安靜的等待庫的編譯完成

 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved