VisualStudio 2013でBoostを使おうとして下記URLをでインストールしようとしたところ、私の環境では上手く行かなかったので、上手く行った方法をメモ。
https://qiita.com/takuya-ki/items/3555ab17f9cea534e13b
https://boostjp.github.io/howtobuild.html
ダウンロード
こちらから Downloads->windows->boost_1_65_1.7zもしくはboost_1_65_1.zipをダウンロード
http://www.boost.org/users/history/version_1_65_1.html
bootstrap.bat
bootstrap.batを実行すれば良いのですが、この部分でエラーが出ました。
C:\WINDOWS\system32>cd C:\Users\XXX\Downloads\boost_1_65_1
C:\Users\XXX\Downloads\boost_1_65_1>bootstrap.bat
Building Boost.Build engine
Failed to build Boost.Build engine.
Please consult bootstrap.log for further diagnostics.
You can try to obtain a prebuilt binary from
http://sf.net/project/showfiles.php?group_id=7586&package_id=72941
Also, you can file an issue at http://svn.boost.org
Please attach bootstrap.log in that case.
原因はパス関係のようですが、調べてみた所、
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts
にある、開発者コマンド プロンプト for VS2013
というやつでbootstrap.batを実行すると通りました。
cd (解凍したディレクトリ)
bootstrap.bat
後は下記のURLと同じ方法で通ります。
https://qiita.com/takuya-ki/items/3555ab17f9cea534e13b
続けて下記も実行
b2.exe toolset=msvc-12.0 link=static runtime-link=static,shared --build-dir=build/x86 address-model=32 -j5 install --includedir=C:\boost_1_65_1\include --libdir=C:\boost_1_65_1\lib\x86
b2.exe toolset=msvc-12.0 link=static runtime-link=static,shared --build-dir=build/x64 address-model=64 -j5 install --includedir=C:\boost_1_65_1\include --libdir=C:\boost_1_65_1\lib\x64
Cの直下にboost_1_65_1というディレクトリにBoostが入ります。
使用方法
プロジェクトを開いて(あるいは新たに作成して)、
プロジェクト->(プロジェクト)のプロパティ->構成プロパティ->C/C++->追加のインクルードディレクトリ
に以下を追加
C:\boost_1_65_1\include\boost-1_65_1
プロジェクト->(プロジェクト)のプロパティ->構成プロパティ->リンカー->追加のライブラリディレクトリ
に以下を追加
# 32bit用
C:\boost_1_65_1\lib\x86
# 64bit用
C:\boost_1_65_1\lib\x64
修正
バージョンの記述が間違っておりましたので修正。