|
|
|
@ -26,60 +26,61 @@ not supported—they may or may not work.</p>
|
|
|
|
|
<div class="contents topic" id="index">
|
|
|
|
|
<p class="topic-title first">Index</p>
|
|
|
|
|
<ul class="auto-toc simple">
|
|
|
|
|
<li><a class="reference internal" href="#get-boost" id="id24">1 Get Boost</a></li>
|
|
|
|
|
<li><a class="reference internal" href="#the-boost-distribution" id="id25">2 The Boost Distribution</a></li>
|
|
|
|
|
<li><a class="reference internal" href="#header-only-libraries" id="id26">3 Header-Only Libraries</a></li>
|
|
|
|
|
<li><a class="reference internal" href="#build-a-simple-program-using-boost" id="id27">4 Build a Simple Program Using Boost</a><ul class="auto-toc">
|
|
|
|
|
<li><a class="reference internal" href="#build-from-the-visual-studio-ide" id="id28">4.1 Build From the Visual Studio IDE</a></li>
|
|
|
|
|
<li><a class="reference internal" href="#or-build-from-the-command-prompt" id="id29">4.2 Or, Build From the Command Prompt</a></li>
|
|
|
|
|
<li><a class="reference internal" href="#errors-and-warnings" id="id30">4.3 Errors and Warnings</a></li>
|
|
|
|
|
<li><a class="reference internal" href="#get-boost" id="id26">1 Get Boost</a></li>
|
|
|
|
|
<li><a class="reference internal" href="#the-boost-distribution" id="id27">2 The Boost Distribution</a></li>
|
|
|
|
|
<li><a class="reference internal" href="#header-only-libraries" id="id28">3 Header-Only Libraries</a></li>
|
|
|
|
|
<li><a class="reference internal" href="#build-a-simple-program-using-boost" id="id29">4 Build a Simple Program Using Boost</a><ul class="auto-toc">
|
|
|
|
|
<li><a class="reference internal" href="#build-from-the-visual-studio-ide" id="id30">4.1 Build From the Visual Studio IDE</a></li>
|
|
|
|
|
<li><a class="reference internal" href="#or-build-from-the-command-prompt" id="id31">4.2 Or, Build From the Command Prompt</a></li>
|
|
|
|
|
<li><a class="reference internal" href="#errors-and-warnings" id="id32">4.3 Errors and Warnings</a></li>
|
|
|
|
|
</ul>
|
|
|
|
|
</li>
|
|
|
|
|
<li><a class="reference internal" href="#prepare-to-use-a-boost-library-binary" id="id31">5 Prepare to Use a Boost Library Binary</a><ul class="auto-toc">
|
|
|
|
|
<li><a class="reference internal" href="#install-visual-studio-2005-or-net-2003-binaries" id="id32">5.1 Install Visual Studio (2005 or .NET 2003) Binaries</a></li>
|
|
|
|
|
<li><a class="reference internal" href="#or-build-binaries-from-source" id="id33">5.2 Or, Build Binaries From Source</a><ul class="auto-toc">
|
|
|
|
|
<li><a class="reference internal" href="#get-bjam" id="id34">5.2.1 Get <tt class="docutils literal"><span class="pre">bjam</span></tt></a></li>
|
|
|
|
|
<li><a class="reference internal" href="#identify-your-toolset" id="id35">5.2.2 Identify Your Toolset</a></li>
|
|
|
|
|
<li><a class="reference internal" href="#select-a-build-directory" id="id36">5.2.3 Select a Build Directory</a></li>
|
|
|
|
|
<li><a class="reference internal" href="#invoke-bjam" id="id37">5.2.4 Invoke <tt class="docutils literal"><span class="pre">bjam</span></tt></a></li>
|
|
|
|
|
<li><a class="reference internal" href="#prepare-to-use-a-boost-library-binary" id="id33">5 Prepare to Use a Boost Library Binary</a><ul class="auto-toc">
|
|
|
|
|
<li><a class="reference internal" href="#install-visual-studio-binaries" id="id34">5.1 Install Visual Studio Binaries</a></li>
|
|
|
|
|
<li><a class="reference internal" href="#or-build-binaries-from-source" id="id35">5.2 Or, Build Binaries From Source</a><ul class="auto-toc">
|
|
|
|
|
<li><a class="reference internal" href="#get-bjam" id="id36">5.2.1 Get <tt class="docutils literal"><span class="pre">bjam</span></tt></a></li>
|
|
|
|
|
<li><a class="reference internal" href="#identify-your-toolset" id="id37">5.2.2 Identify Your Toolset</a></li>
|
|
|
|
|
<li><a class="reference internal" href="#select-a-build-directory" id="id38">5.2.3 Select a Build Directory</a></li>
|
|
|
|
|
<li><a class="reference internal" href="#invoke-bjam" id="id39">5.2.4 Invoke <tt class="docutils literal"><span class="pre">bjam</span></tt></a></li>
|
|
|
|
|
</ul>
|
|
|
|
|
</li>
|
|
|
|
|
<li><a class="reference internal" href="#expected-build-output" id="id38">5.3 Expected Build Output</a></li>
|
|
|
|
|
<li><a class="reference internal" href="#in-case-of-build-errors" id="id39">5.4 In Case of Build Errors</a></li>
|
|
|
|
|
<li><a class="reference internal" href="#expected-build-output" id="id40">5.3 Expected Build Output</a></li>
|
|
|
|
|
<li><a class="reference internal" href="#in-case-of-build-errors" id="id41">5.4 In Case of Build Errors</a></li>
|
|
|
|
|
</ul>
|
|
|
|
|
</li>
|
|
|
|
|
<li><a class="reference internal" href="#link-your-program-to-a-boost-library" id="id40">6 Link Your Program to a Boost Library</a><ul class="auto-toc">
|
|
|
|
|
<li><a class="reference internal" href="#link-from-within-the-visual-studio-ide" id="id41">6.1 Link From Within the Visual Studio IDE</a></li>
|
|
|
|
|
<li><a class="reference internal" href="#or-link-from-the-command-prompt" id="id42">6.2 Or, Link From the Command Prompt</a></li>
|
|
|
|
|
<li><a class="reference internal" href="#library-naming" id="id43">6.3 Library Naming</a></li>
|
|
|
|
|
<li><a class="reference internal" href="#test-your-program" id="id44">6.4 Test Your Program</a></li>
|
|
|
|
|
<li><a class="reference internal" href="#link-your-program-to-a-boost-library" id="id42">6 Link Your Program to a Boost Library</a><ul class="auto-toc">
|
|
|
|
|
<li><a class="reference internal" href="#link-from-within-the-visual-studio-ide" id="id43">6.1 Link From Within the Visual Studio IDE</a></li>
|
|
|
|
|
<li><a class="reference internal" href="#or-link-from-the-command-prompt" id="id44">6.2 Or, Link From the Command Prompt</a></li>
|
|
|
|
|
<li><a class="reference internal" href="#library-naming" id="id45">6.3 Library Naming</a></li>
|
|
|
|
|
<li><a class="reference internal" href="#test-your-program" id="id46">6.4 Test Your Program</a></li>
|
|
|
|
|
</ul>
|
|
|
|
|
</li>
|
|
|
|
|
<li><a class="reference internal" href="#conclusion-and-further-resources" id="id45">7 Conclusion and Further Resources</a></li>
|
|
|
|
|
<li><a class="reference internal" href="#conclusion-and-further-resources" id="id47">7 Conclusion and Further Resources</a></li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="get-boost">
|
|
|
|
|
<h1><a class="toc-backref" href="#id24">1 Get Boost</a></h1>
|
|
|
|
|
<p>The easiest way to get a copy of Boost is to use the <a class="reference external" href="http://www.boost-consulting.com/download/windows">installer</a>
|
|
|
|
|
provided by <a class="reference external" href="http://www.boost-consulting.com">Boost Consulting</a>. We especially recommend this
|
|
|
|
|
method if you use Microsoft Visual Studio .NET 2003 or Microsoft
|
|
|
|
|
Visual Studio 2005, because the installer can download and install
|
|
|
|
|
<h1><a class="toc-backref" href="#id26">1 Get Boost</a></h1>
|
|
|
|
|
<p>The easiest way to get a copy of Boost is to use an installer.
|
|
|
|
|
The <a class="reference external" href="http://www.boost.org/doc/libs/1_36_0/more/getting_started/index.html">Boost website version of this Getting Started guide</a> will
|
|
|
|
|
have undated information on installers as they become available,
|
|
|
|
|
or see <a class="reference external" href="http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=8041">Boost downloads</a> or the <a class="reference external" href="http://www.boostpro.com/products/free">installer</a> provided by <a class="reference external" href="http://www.boostpro.com">BoostPro Computing</a>. We especially recommend using
|
|
|
|
|
an installer if you use Microsoft Visual Studio, because the installer can download and install
|
|
|
|
|
precompiled library binaries, saving you the trouble of building
|
|
|
|
|
them yourself. To complete this tutorial, you'll need to at least
|
|
|
|
|
install the <a class="reference external" href="../../libs/regex/index.html">Boost.Regex</a> binaries when given the option.</p>
|
|
|
|
|
<p>If you're using an earlier version of Visual Studio or some other
|
|
|
|
|
compiler, or if you prefer to build everything yourself, you can
|
|
|
|
|
download <a class="reference external" href="http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=8041"><tt class="docutils literal"><span class="pre">boost_1_35_0</span></tt><tt class="docutils literal"><span class="pre">.exe</span></tt></a> and run it to install a complete Boost
|
|
|
|
|
download <a class="reference external" href="http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=8041"><tt class="docutils literal"><span class="pre">boost_1_36_0</span></tt><tt class="docutils literal"><span class="pre">.7z</span></tt></a> or <a class="reference external" href="http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=8041"><tt class="docutils literal"><span class="pre">boost_1_36_0</span></tt><tt class="docutils literal"><span class="pre">.zip</span></tt></a> and unpack it to install a complete Boost
|
|
|
|
|
distribution.<a class="footnote-reference" href="#zip" id="id2"><sup>1</sup></a></p>
|
|
|
|
|
<!-- Copyright David Abrahams 2006. Distributed under the Boost -->
|
|
|
|
|
<!-- Software License, Version 1.0. (See accompanying -->
|
|
|
|
|
<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="the-boost-distribution">
|
|
|
|
|
<h1><a class="toc-backref" href="#id25">2 The Boost Distribution</a></h1>
|
|
|
|
|
<h1><a class="toc-backref" href="#id27">2 The Boost Distribution</a></h1>
|
|
|
|
|
<p>This is a sketch of the resulting directory structure:</p>
|
|
|
|
|
<pre class="literal-block">
|
|
|
|
|
<strong>boost_1_35_0</strong><strong>\</strong> .................<em>The “boost root directory”</em>
|
|
|
|
|
<strong>boost_1_36_0</strong><strong>\</strong> .................<em>The “boost root directory”</em>
|
|
|
|
|
<strong>index.htm</strong> .........<em>A copy of www.boost.org starts here</em>
|
|
|
|
|
<strong>boost</strong><strong>\</strong> .........................<em>All Boost Header files</em>
|
|
|
|
|
<strong>lib</strong><strong>\</strong> .....................<em>precompiled library binaries</em>
|
|
|
|
@ -124,7 +125,7 @@ anything you can use in these directories.</p>
|
|
|
|
|
</div>
|
|
|
|
|
<p>It's important to note the following:</p>
|
|
|
|
|
<ol class="arabic" id="boost-root-directory">
|
|
|
|
|
<li><p class="first">The path to the <strong>boost root directory</strong> (often <tt class="docutils literal"><span class="pre">C:\Program</span> <span class="pre">Files\boost\</span></tt><tt class="docutils literal"><span class="pre">boost_1_35_0</span></tt>) is
|
|
|
|
|
<li><p class="first">The path to the <strong>boost root directory</strong> (often <tt class="docutils literal"><span class="pre">C:\Program</span> <span class="pre">Files\boost\</span></tt><tt class="docutils literal"><span class="pre">boost_1_36_0</span></tt>) is
|
|
|
|
|
sometimes referred to as <tt class="docutils literal"><span class="pre">$BOOST_ROOT</span></tt> in documentation and
|
|
|
|
|
mailing lists .</p>
|
|
|
|
|
</li>
|
|
|
|
@ -159,7 +160,7 @@ contains a subset of the Boost documentation. Start with
|
|
|
|
|
<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="header-only-libraries">
|
|
|
|
|
<h1><a class="toc-backref" href="#id26">3 Header-Only Libraries</a></h1>
|
|
|
|
|
<h1><a class="toc-backref" href="#id28">3 Header-Only Libraries</a></h1>
|
|
|
|
|
<p>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.</p>
|
|
|
|
|
<div class="admonition-nothing-to-build admonition">
|
|
|
|
@ -199,7 +200,7 @@ use</strong>.</li>
|
|
|
|
|
<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="build-a-simple-program-using-boost">
|
|
|
|
|
<h1><a class="toc-backref" href="#id27">4 Build a Simple Program Using Boost</a></h1>
|
|
|
|
|
<h1><a class="toc-backref" href="#id29">4 Build a Simple Program Using Boost</a></h1>
|
|
|
|
|
<p>To keep things simple, let's start by using a header-only library.
|
|
|
|
|
The following program reads a sequence of integers from standard
|
|
|
|
|
input, uses Boost.Lambda to multiply each number by three, and
|
|
|
|
@ -248,14 +249,14 @@ cd <em>path</em>\<em>to</em>\<em>some</em>\<em>directory</em>
|
|
|
|
|
</pre>
|
|
|
|
|
<p>followed by Return. For example,</p>
|
|
|
|
|
<pre class="literal-block">
|
|
|
|
|
cd <tt class="docutils literal"><span class="pre">C:\Program</span> <span class="pre">Files\boost\</span></tt><tt class="docutils literal"><span class="pre">boost_1_35_0</span></tt>
|
|
|
|
|
cd <tt class="docutils literal"><span class="pre">C:\Program</span> <span class="pre">Files\boost\</span></tt><tt class="docutils literal"><span class="pre">boost_1_36_0</span></tt>
|
|
|
|
|
</pre>
|
|
|
|
|
<p class="last">Long commands can be continued across several lines by typing a
|
|
|
|
|
caret (<tt class="docutils literal"><span class="pre">^</span></tt>) at the end of all but the last line. Some examples
|
|
|
|
|
on this page use that technique to save horizontal space.</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="build-from-the-visual-studio-ide">
|
|
|
|
|
<span id="vs-header-only"></span><h2><a class="toc-backref" href="#id28">4.1 Build From the Visual Studio IDE</a></h2>
|
|
|
|
|
<span id="vs-header-only"></span><h2><a class="toc-backref" href="#id30">4.1 Build From the Visual Studio IDE</a></h2>
|
|
|
|
|
<ul>
|
|
|
|
|
<li><p class="first">From Visual Studio's <em>File</em> menu, select <em>New</em> > <em>Project…</em></p>
|
|
|
|
|
</li>
|
|
|
|
@ -273,7 +274,7 @@ select <em>Properties</em> from the resulting pop-up menu</p>
|
|
|
|
|
<li><p class="first">In <em>Configuration Properties</em> > <em>C/C++</em> > <em>General</em> > <em>Additional Include
|
|
|
|
|
Directories</em>, enter the path to the Boost root directory, for example</p>
|
|
|
|
|
<blockquote>
|
|
|
|
|
<p><tt class="docutils literal"><span class="pre">C:\Program</span> <span class="pre">Files\boost\</span></tt><tt class="docutils literal"><span class="pre">boost_1_35_0</span></tt></p>
|
|
|
|
|
<p><tt class="docutils literal"><span class="pre">C:\Program</span> <span class="pre">Files\boost\</span></tt><tt class="docutils literal"><span class="pre">boost_1_36_0</span></tt></p>
|
|
|
|
|
</blockquote>
|
|
|
|
|
</li>
|
|
|
|
|
<li><p class="first">In <em>Configuration Properties</em> > <em>C/C++</em> > <em>Precompiled Headers</em>, change
|
|
|
|
@ -296,7 +297,7 @@ Return key.</p>
|
|
|
|
|
<p><a class="reference internal" href="#errors-and-warnings"><em>skip to the next step</em></a></p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="or-build-from-the-command-prompt">
|
|
|
|
|
<h2><a class="toc-backref" href="#id29">4.2 Or, Build From the Command Prompt</a></h2>
|
|
|
|
|
<h2><a class="toc-backref" href="#id31">4.2 Or, Build From the Command Prompt</a></h2>
|
|
|
|
|
<p>From your computer's <em>Start</em> menu, if you are a Visual
|
|
|
|
|
Studio 2005 user, select</p>
|
|
|
|
|
<blockquote>
|
|
|
|
@ -311,7 +312,7 @@ Visual Studio compiler. In that window, set the <a class="reference internal" h
|
|
|
|
|
directory</a> to a suitable location for creating some temporary
|
|
|
|
|
files and type the following command followed by the Return key:</p>
|
|
|
|
|
<pre class="literal-block">
|
|
|
|
|
cl /EHsc /I <em>path\to\</em><tt class="docutils literal"><span class="pre">boost_1_35_0</span></tt> <em>path</em>\<em>to</em>\example.cpp
|
|
|
|
|
cl /EHsc /I <em>path\to\</em><tt class="docutils literal"><span class="pre">boost_1_36_0</span></tt> <em>path</em>\<em>to</em>\example.cpp
|
|
|
|
|
</pre>
|
|
|
|
|
<p>To test the result, type:</p>
|
|
|
|
|
<pre class="literal-block">
|
|
|
|
@ -322,7 +323,7 @@ echo 1 2 3 | example
|
|
|
|
|
<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="errors-and-warnings">
|
|
|
|
|
<h2><a class="toc-backref" href="#id30">4.3 Errors and Warnings</a></h2>
|
|
|
|
|
<h2><a class="toc-backref" href="#id32">4.3 Errors and Warnings</a></h2>
|
|
|
|
|
<p>Don't be alarmed if you see compiler warnings originating in Boost
|
|
|
|
|
headers. We try to eliminate them, but doing so isn't always
|
|
|
|
|
practical.<a class="footnote-reference" href="#warnings" id="id7"><sup>5</sup></a> <strong>Errors are another matter</strong>. If you're
|
|
|
|
@ -335,21 +336,21 @@ correctly identified the <a class="reference internal" href="#boost-root-directo
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="prepare-to-use-a-boost-library-binary">
|
|
|
|
|
<h1><a class="toc-backref" href="#id31">5 Prepare to Use a Boost Library Binary</a></h1>
|
|
|
|
|
<h1><a class="toc-backref" href="#id33">5 Prepare to Use a Boost Library Binary</a></h1>
|
|
|
|
|
<p>If you want to use any of the separately-compiled Boost libraries,
|
|
|
|
|
you'll need to acquire library binaries.</p>
|
|
|
|
|
<div class="section" id="install-visual-studio-2005-or-net-2003-binaries">
|
|
|
|
|
<h2><a class="toc-backref" href="#id32">5.1 Install Visual Studio (2005 or .NET 2003) Binaries</a></h2>
|
|
|
|
|
<p>The <a class="reference external" href="http://www.boost-consulting.com/download/windows">installer</a> supplied by Boost Consulting will download and
|
|
|
|
|
<div class="section" id="install-visual-studio-binaries">
|
|
|
|
|
<h2><a class="toc-backref" href="#id34">5.1 Install Visual Studio Binaries</a></h2>
|
|
|
|
|
<p>The installers will download and
|
|
|
|
|
install pre-compiled binaries into the <tt class="docutils literal"><span class="pre">lib\</span></tt> subdirectory of the
|
|
|
|
|
boost root, typically <tt class="docutils literal"><span class="pre">C:\Program</span> <span class="pre">Files\boost\</span></tt><tt class="docutils literal"><span class="pre">boost_1_35_0</span></tt><tt class="docutils literal"><span class="pre">\lib\</span></tt>. If you installed
|
|
|
|
|
boost root, typically <tt class="docutils literal"><span class="pre">C:\Program</span> <span class="pre">Files\boost\</span></tt><tt class="docutils literal"><span class="pre">boost_1_36_0</span></tt><tt class="docutils literal"><span class="pre">\lib\</span></tt>. If you installed
|
|
|
|
|
all variants of the <a class="reference external" href="../../libs/regex/index.html">Boost.Regex</a> binary, you're done with this
|
|
|
|
|
step. Otherwise, please run the installer again and install them
|
|
|
|
|
now.</p>
|
|
|
|
|
<p><a class="reference internal" href="#link-your-program-to-a-boost-library"><em>skip to the next step</em></a></p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="or-build-binaries-from-source">
|
|
|
|
|
<h2><a class="toc-backref" href="#id33">5.2 Or, Build Binaries From Source</a></h2>
|
|
|
|
|
<h2><a class="toc-backref" href="#id35">5.2 Or, Build Binaries From Source</a></h2>
|
|
|
|
|
<p>If you're using an earlier version of Visual C++, or a compiler
|
|
|
|
|
from another vendor, you'll need to use <a class="reference external" href="../../tools/build/index.html">Boost.Build</a> to create your
|
|
|
|
|
own binaries.</p>
|
|
|
|
@ -361,7 +362,7 @@ installing software. To use it, you'll need an executable called
|
|
|
|
|
<tt class="docutils literal"><span class="pre">bjam</span></tt>.</p>
|
|
|
|
|
<!-- .. _Boost.Jam documentation: Boost.Jam_ -->
|
|
|
|
|
<div class="section" id="get-bjam">
|
|
|
|
|
<h3><a class="toc-backref" href="#id34">5.2.1 Get <tt class="docutils literal"><span class="pre">bjam</span></tt></a></h3>
|
|
|
|
|
<h3><a class="toc-backref" href="#id36">5.2.1 Get <tt class="docutils literal"><span class="pre">bjam</span></tt></a></h3>
|
|
|
|
|
<p><tt class="docutils literal"><span class="pre">bjam</span></tt> is the <a class="reference internal" href="#command-line-tool">command-line tool</a> that drives the Boost Build
|
|
|
|
|
system. To build Boost binaries, you'll invoke <tt class="docutils literal"><span class="pre">bjam</span></tt> from the
|
|
|
|
|
Boost root.</p>
|
|
|
|
@ -370,7 +371,7 @@ Alternatively, you can build <tt class="docutils literal"><span class="pre">bjam
|
|
|
|
|
instructions</a>.</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="identify-your-toolset">
|
|
|
|
|
<span id="toolset-name"></span><span id="toolset"></span><h3><a class="toc-backref" href="#id35">5.2.2 Identify Your Toolset</a></h3>
|
|
|
|
|
<span id="toolset-name"></span><span id="toolset"></span><h3><a class="toc-backref" href="#id37">5.2.2 Identify Your Toolset</a></h3>
|
|
|
|
|
<p>First, find the toolset corresponding to your compiler in the
|
|
|
|
|
following table.</p>
|
|
|
|
|
<div class="note">
|
|
|
|
@ -475,7 +476,7 @@ are using the msvc or gcc toolsets, which have special version
|
|
|
|
|
detection code) or <a class="reference internal" href="#auto-linking">auto-linking</a> will fail.</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="select-a-build-directory">
|
|
|
|
|
<span id="id12"></span><span id="build-directory"></span><h3><a class="toc-backref" href="#id36">5.2.3 Select a Build Directory</a></h3>
|
|
|
|
|
<span id="id12"></span><span id="build-directory"></span><h3><a class="toc-backref" href="#id38">5.2.3 Select a Build Directory</a></h3>
|
|
|
|
|
<p><a class="reference external" href="../../tools/build/index.html">Boost.Build</a> will place all intermediate files it generates while
|
|
|
|
|
building into the <strong>build directory</strong>. If your Boost root
|
|
|
|
|
directory is writable, this step isn't strictly necessary: by
|
|
|
|
@ -483,21 +484,29 @@ default Boost.Build will create a <tt class="docutils literal"><span class="pre"
|
|
|
|
|
purpose in your current working directory.</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="invoke-bjam">
|
|
|
|
|
<h3><a class="toc-backref" href="#id37">5.2.4 Invoke <tt class="docutils literal"><span class="pre">bjam</span></tt></a></h3>
|
|
|
|
|
<h3><a class="toc-backref" href="#id39">5.2.4 Invoke <tt class="docutils literal"><span class="pre">bjam</span></tt></a></h3>
|
|
|
|
|
<p>Change your current directory to the Boost root directory and
|
|
|
|
|
invoke <tt class="docutils literal"><span class="pre">bjam</span></tt> as follows:</p>
|
|
|
|
|
<pre class="literal-block">
|
|
|
|
|
bjam <strong>--build-dir=</strong><a class="reference internal" href="#id12"><em>build-directory</em></a> <strong>--toolset=</strong><a class="reference internal" href="#toolset-name"><em>toolset-name</em></a> stage
|
|
|
|
|
bjam <strong>--build-dir=</strong><a class="reference internal" href="#id12"><em>build-directory</em></a> <strong>--toolset=</strong><a class="reference internal" href="#toolset-name"><em>toolset-name</em></a> <em>[</em><strong>--build-type=complete</strong><em>]</em> stage
|
|
|
|
|
</pre>
|
|
|
|
|
<p>For example, your session might look like this:<a class="footnote-reference" href="#continuation" id="id13"><sup>4</sup></a></p>
|
|
|
|
|
<pre class="literal-block">
|
|
|
|
|
C:\WINDOWS> cd <tt class="docutils literal"><span class="pre">C:\Program</span> <span class="pre">Files\boost\</span></tt><tt class="docutils literal"><span class="pre">boost_1_35_0</span></tt>
|
|
|
|
|
<tt class="docutils literal"><span class="pre">C:\Program</span> <span class="pre">Files\boost\</span></tt><tt class="docutils literal"><span class="pre">boost_1_35_0</span></tt>> bjam <strong>^</strong>
|
|
|
|
|
C:\WINDOWS> cd <tt class="docutils literal"><span class="pre">C:\Program</span> <span class="pre">Files\boost\</span></tt><tt class="docutils literal"><span class="pre">boost_1_36_0</span></tt>
|
|
|
|
|
<tt class="docutils literal"><span class="pre">C:\Program</span> <span class="pre">Files\boost\</span></tt><tt class="docutils literal"><span class="pre">boost_1_36_0</span></tt>> bjam <strong>^</strong>
|
|
|
|
|
More? <strong>--build-dir=</strong>"C:\Documents and Settings\dave\build-boost" <strong>^</strong>
|
|
|
|
|
More? <strong>--toolset=</strong>msvc stage
|
|
|
|
|
</pre>
|
|
|
|
|
<p>Be sure to read <a class="reference internal" href="#continuation">this note</a> about the appearance of <tt class="docutils literal"><span class="pre">^</span></tt>,
|
|
|
|
|
<tt class="docutils literal"><span class="pre">More?</span></tt> and quotation marks (<tt class="docutils literal"><span class="pre">"</span></tt>) in that line.</p>
|
|
|
|
|
<p>The above example session will build static and shared non-debug multi-threaded
|
|
|
|
|
variations of the libraries. To build all variations:</p>
|
|
|
|
|
<pre class="literal-block">
|
|
|
|
|
C:\WINDOWS> cd <tt class="docutils literal"><span class="pre">C:\Program</span> <span class="pre">Files\boost\</span></tt><tt class="docutils literal"><span class="pre">boost_1_36_0</span></tt>
|
|
|
|
|
<tt class="docutils literal"><span class="pre">C:\Program</span> <span class="pre">Files\boost\</span></tt><tt class="docutils literal"><span class="pre">boost_1_36_0</span></tt>> bjam <strong>^</strong>
|
|
|
|
|
More? <strong>--build-dir=</strong>"C:\Documents and Settings\dave\build-boost" <strong>^</strong>
|
|
|
|
|
More? <strong>--toolset=</strong>msvc <strong>--build-type=complete</strong> stage
|
|
|
|
|
</pre>
|
|
|
|
|
<!-- Copyright David Abrahams 2006. Distributed under the Boost -->
|
|
|
|
|
<!-- Software License, Version 1.0. (See accompanying -->
|
|
|
|
|
<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
|
|
|
|
@ -525,7 +534,7 @@ be interested in:</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="expected-build-output">
|
|
|
|
|
<h2><a class="toc-backref" href="#id38">5.3 Expected Build Output</a></h2>
|
|
|
|
|
<h2><a class="toc-backref" href="#id40">5.3 Expected Build Output</a></h2>
|
|
|
|
|
<p>During the process of building Boost libraries, you can expect to
|
|
|
|
|
see some messages printed on the console. These may include</p>
|
|
|
|
|
<ul>
|
|
|
|
@ -549,7 +558,7 @@ look something like:</p>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="in-case-of-build-errors">
|
|
|
|
|
<h2><a class="toc-backref" href="#id39">5.4 In Case of Build Errors</a></h2>
|
|
|
|
|
<h2><a class="toc-backref" href="#id41">5.4 In Case of Build Errors</a></h2>
|
|
|
|
|
<p>The only error messages you see when building Boost—if any—should
|
|
|
|
|
be related to the IOStreams library's support of zip and bzip2
|
|
|
|
|
formats as described <a class="reference external" href="../../libs/iostreams/doc/installation.html">here</a>. Install the relevant development
|
|
|
|
@ -567,7 +576,7 @@ questions about configuring Boost for your compiler to the
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="link-your-program-to-a-boost-library">
|
|
|
|
|
<h1><a class="toc-backref" href="#id40">6 Link Your Program to a Boost Library</a></h1>
|
|
|
|
|
<h1><a class="toc-backref" href="#id42">6 Link Your Program to a Boost Library</a></h1>
|
|
|
|
|
<p>To demonstrate linking with a Boost binary library, we'll use the
|
|
|
|
|
following simple program that extracts the subject lines from
|
|
|
|
|
emails. It uses the <a class="reference external" href="../../libs/regex/index.html">Boost.Regex</a> library, which has a
|
|
|
|
@ -612,7 +621,7 @@ GCC users should refer to the <a class="reference external" href="unix-variants.
|
|
|
|
|
variant OSes</a> for the appropriate command-line options to use.</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="link-from-within-the-visual-studio-ide">
|
|
|
|
|
<h2><a class="toc-backref" href="#id41">6.1 Link From Within the Visual Studio IDE</a></h2>
|
|
|
|
|
<h2><a class="toc-backref" href="#id43">6.1 Link From Within the Visual Studio IDE</a></h2>
|
|
|
|
|
<p>Starting with the <a class="reference internal" href="#vs-header-only">header-only example project</a> we created
|
|
|
|
|
earlier:</p>
|
|
|
|
|
<ol class="arabic simple">
|
|
|
|
@ -620,24 +629,24 @@ earlier:</p>
|
|
|
|
|
select <em>Properties</em> from the resulting pop-up menu</li>
|
|
|
|
|
<li>In <em>Configuration Properties</em> > <em>Linker</em> > <em>Additional Library
|
|
|
|
|
Directories</em>, enter the path to the Boost binaries,
|
|
|
|
|
e.g. <tt class="docutils literal"><span class="pre">C:\Program</span> <span class="pre">Files\boost\</span></tt><tt class="docutils literal"><span class="pre">boost_1_35_0</span></tt><tt class="docutils literal"><span class="pre">\lib\</span></tt>.</li>
|
|
|
|
|
e.g. <tt class="docutils literal"><span class="pre">C:\Program</span> <span class="pre">Files\boost\</span></tt><tt class="docutils literal"><span class="pre">boost_1_36_0</span></tt><tt class="docutils literal"><span class="pre">\lib\</span></tt>.</li>
|
|
|
|
|
<li>From the <em>Build</em> menu, select <em>Build Solution</em>.</li>
|
|
|
|
|
</ol>
|
|
|
|
|
<p><a class="reference internal" href="#test-your-program"><em>skip to the next step</em></a></p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="or-link-from-the-command-prompt">
|
|
|
|
|
<h2><a class="toc-backref" href="#id42">6.2 Or, Link From the Command Prompt</a></h2>
|
|
|
|
|
<h2><a class="toc-backref" href="#id44">6.2 Or, Link From the Command Prompt</a></h2>
|
|
|
|
|
<p>For example, we can compile and link the above program from the
|
|
|
|
|
Visual C++ command-line by simply adding the <strong>bold</strong> text below to
|
|
|
|
|
the command line we used earlier, assuming your Boost binaries are
|
|
|
|
|
in <tt class="docutils literal"><span class="pre">C:\Program</span> <span class="pre">Files\boost\</span></tt><tt class="docutils literal"><span class="pre">boost_1_35_0</span></tt><tt class="docutils literal"><span class="pre">\lib</span></tt>:</p>
|
|
|
|
|
in <tt class="docutils literal"><span class="pre">C:\Program</span> <span class="pre">Files\boost\</span></tt><tt class="docutils literal"><span class="pre">boost_1_36_0</span></tt><tt class="docutils literal"><span class="pre">\lib</span></tt>:</p>
|
|
|
|
|
<pre class="literal-block">
|
|
|
|
|
cl /EHsc /I <em>path\to\</em><tt class="docutils literal"><span class="pre">boost_1_35_0</span></tt> example.cpp <strong>^</strong>
|
|
|
|
|
<strong>/link /LIBPATH:</strong> <strong>C:\Program Files\boost\</strong><strong>boost_1_35_0</strong><strong>\lib</strong>
|
|
|
|
|
cl /EHsc /I <em>path\to\</em><tt class="docutils literal"><span class="pre">boost_1_36_0</span></tt> example.cpp <strong>^</strong>
|
|
|
|
|
<strong>/link /LIBPATH:</strong> <strong>C:\Program Files\boost\</strong><strong>boost_1_36_0</strong><strong>\lib</strong>
|
|
|
|
|
</pre>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="library-naming">
|
|
|
|
|
<h2><a class="toc-backref" href="#id43">6.3 Library Naming</a></h2>
|
|
|
|
|
<h2><a class="toc-backref" href="#id45">6.3 Library Naming</a></h2>
|
|
|
|
|
<div class="note">
|
|
|
|
|
<p class="first admonition-title">Note</p>
|
|
|
|
|
<p>If, like Visual C++, your compiler supports auto-linking,
|
|
|
|
@ -737,7 +746,7 @@ version number, will also be created.</dd>
|
|
|
|
|
<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="test-your-program">
|
|
|
|
|
<h2><a class="toc-backref" href="#id44">6.4 Test Your Program</a></h2>
|
|
|
|
|
<h2><a class="toc-backref" href="#id46">6.4 Test Your Program</a></h2>
|
|
|
|
|
<p>To test our subject extraction, we'll filter the following text
|
|
|
|
|
file. Copy it out of your browser and save it as <tt class="docutils literal"><span class="pre">jayne.txt</span></tt>:</p>
|
|
|
|
|
<pre class="literal-block">
|
|
|
|
@ -759,7 +768,7 @@ Spoil Rock Hunter?”</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="conclusion-and-further-resources">
|
|
|
|
|
<h1><a class="toc-backref" href="#id45">7 Conclusion and Further Resources</a></h1>
|
|
|
|
|
<h1><a class="toc-backref" href="#id47">7 Conclusion and Further Resources</a></h1>
|
|
|
|
|
<p>This concludes your introduction to Boost and to integrating it
|
|
|
|
|
with your programs. As you start using Boost in earnest, there are
|
|
|
|
|
surely a few additional points you'll wish we had covered. One day
|
|
|
|
@ -787,16 +796,17 @@ mailing list</a>.</p>
|
|
|
|
|
<table class="docutils footnote" frame="void" id="zip" rules="none">
|
|
|
|
|
<colgroup><col class="label" /><col /></colgroup>
|
|
|
|
|
<tbody valign="top">
|
|
|
|
|
<tr><td class="label"><a class="fn-backref" href="#id2">[1]</a></td><td>If you prefer not to download executable programs,
|
|
|
|
|
download <a class="reference external" href="http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=8041"><tt class="docutils literal"><span class="pre">boost_1_35_0</span></tt><tt class="docutils literal"><span class="pre">.zip</span></tt></a> and use an external tool to decompress
|
|
|
|
|
it. We don't recommend using Windows' built-in decompression as
|
|
|
|
|
it can be painfully slow for large archives.</td></tr>
|
|
|
|
|
<tr><td class="label"><a class="fn-backref" href="#id2">[1]</a></td><td>We recommend
|
|
|
|
|
downloading <a class="reference external" href="http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=8041"><tt class="docutils literal"><span class="pre">boost_1_36_0</span></tt><tt class="docutils literal"><span class="pre">.7z</span></tt></a> and using <a class="reference external" href="http://www.7-zip.org">7-Zip</a> to decompress
|
|
|
|
|
it. We no longer recommend .zip files for Boost because they are twice
|
|
|
|
|
as large as the equivalent .7z files. We don't recommend using Windows'
|
|
|
|
|
built-in decompression as it can be painfully slow for large archives.</td></tr>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
<table class="docutils footnote" frame="void" id="installer-src" rules="none">
|
|
|
|
|
<colgroup><col class="label" /><col /></colgroup>
|
|
|
|
|
<tbody valign="top">
|
|
|
|
|
<tr><td class="label">[2]</td><td>If you used the <a class="reference external" href="http://www.boost-consulting.com/download/windows">installer</a> from Boost
|
|
|
|
|
<tr><td class="label">[2]</td><td>If you used the <a class="reference external" href="http://www.boostpro.com/products/free">installer</a> from Boost
|
|
|
|
|
Consulting and deselected “Source and Documentation” (it's
|
|
|
|
|
selected by default), you won't see the <tt class="docutils literal"><span class="pre">libs/</span></tt> subdirectory.
|
|
|
|
|
That won't affect your ability to use precompiled binaries, but
|
|
|
|
|