• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" encoding="utf-8" ?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6<meta name="generator" content="Docutils 0.7: http://docutils.sourceforge.net/" />
7<title>Boost Getting Started on Windows</title>
8<link rel="stylesheet" href="../../rst.css" type="text/css" />
9</head>
10<body>
11<div class="document" id="logo-getting-started-on-windows">
12<h1 class="title"><a class="reference external" href="../../index.htm"><img alt="Boost" class="boost-logo" src="../../boost.png" /></a> Getting Started on Windows</h1>
13
14<!-- Copyright David Abrahams 2006. Distributed under the Boost -->
15<!-- Software License, Version 1.0. (See accompanying -->
16<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
17<div class="admonition-a-note-to-cygwin-and-mingw-users admonition">
18<p class="first admonition-title">A note to <a class="reference external" href="http://www.cygwin.com">Cygwin</a> and <a class="reference external" href="http://mingw.org">MinGW</a> users</p>
19<p class="last">If you plan to use your tools from the Windows command prompt,
20you're in the right place.  If you plan to build from the <a class="reference external" href="http://www.cygwin.com">Cygwin</a>
21bash shell, you're actually running on a POSIX platform and
22should follow the instructions for <a class="reference external" href="unix-variants.html">getting started on Unix
23variants</a>.  Other command shells, such as <a class="reference external" href="http://mingw.org">MinGW</a>'s MSYS, are
24not supported—they may or may not work.</p>
25</div>
26<div class="contents topic" id="index">
27<p class="topic-title first">Index</p>
28<ul class="auto-toc simple">
29<li><a class="reference internal" href="#get-boost" id="id28">1&nbsp;&nbsp;&nbsp;Get Boost</a></li>
30<li><a class="reference internal" href="#the-boost-distribution" id="id29">2&nbsp;&nbsp;&nbsp;The Boost Distribution</a></li>
31<li><a class="reference internal" href="#header-only-libraries" id="id30">3&nbsp;&nbsp;&nbsp;Header-Only Libraries</a></li>
32<li><a class="reference internal" href="#build-a-simple-program-using-boost" id="id31">4&nbsp;&nbsp;&nbsp;Build a Simple Program Using Boost</a><ul class="auto-toc">
33<li><a class="reference internal" href="#build-from-the-visual-studio-ide" id="id32">4.1&nbsp;&nbsp;&nbsp;Build From the Visual Studio IDE</a></li>
34<li><a class="reference internal" href="#or-build-from-the-command-prompt" id="id33">4.2&nbsp;&nbsp;&nbsp;Or, Build From the Command Prompt</a></li>
35<li><a class="reference internal" href="#errors-and-warnings" id="id34">4.3&nbsp;&nbsp;&nbsp;Errors and Warnings</a></li>
36</ul>
37</li>
38<li><a class="reference internal" href="#prepare-to-use-a-boost-library-binary" id="id35">5&nbsp;&nbsp;&nbsp;Prepare to Use a Boost Library Binary</a><ul class="auto-toc">
39<li><a class="reference internal" href="#simplified-build-from-source" id="id36">5.1&nbsp;&nbsp;&nbsp;Simplified Build From Source</a></li>
40<li><a class="reference internal" href="#or-build-binaries-from-source" id="id37">5.2&nbsp;&nbsp;&nbsp;Or, Build Binaries From Source</a><ul class="auto-toc">
41<li><a class="reference internal" href="#install-boost-build" id="id38">5.2.1&nbsp;&nbsp;&nbsp;Install Boost.Build</a></li>
42<li><a class="reference internal" href="#identify-your-toolset" id="id39">5.2.2&nbsp;&nbsp;&nbsp;Identify Your Toolset</a></li>
43<li><a class="reference internal" href="#select-a-build-directory" id="id40">5.2.3&nbsp;&nbsp;&nbsp;Select a Build Directory</a></li>
44<li><a class="reference internal" href="#invoke-b2" id="id41">5.2.4&nbsp;&nbsp;&nbsp;Invoke <tt class="docutils literal">b2</tt></a></li>
45</ul>
46</li>
47<li><a class="reference internal" href="#expected-build-output" id="id42">5.3&nbsp;&nbsp;&nbsp;Expected Build Output</a></li>
48<li><a class="reference internal" href="#in-case-of-build-errors" id="id43">5.4&nbsp;&nbsp;&nbsp;In Case of Build Errors</a></li>
49</ul>
50</li>
51<li><a class="reference internal" href="#link-your-program-to-a-boost-library" id="id44">6&nbsp;&nbsp;&nbsp;Link Your Program to a Boost Library</a><ul class="auto-toc">
52<li><a class="reference internal" href="#link-from-within-the-visual-studio-ide" id="id45">6.1&nbsp;&nbsp;&nbsp;Link From Within the Visual Studio IDE</a></li>
53<li><a class="reference internal" href="#or-link-from-the-command-prompt" id="id46">6.2&nbsp;&nbsp;&nbsp;Or, Link From the Command Prompt</a></li>
54<li><a class="reference internal" href="#library-naming" id="id47">6.3&nbsp;&nbsp;&nbsp;Library Naming</a></li>
55<li><a class="reference internal" href="#test-your-program" id="id48">6.4&nbsp;&nbsp;&nbsp;Test Your Program</a></li>
56</ul>
57</li>
58<li><a class="reference internal" href="#conclusion-and-further-resources" id="id49">7&nbsp;&nbsp;&nbsp;Conclusion and Further Resources</a></li>
59</ul>
60</div>
61<div class="section" id="get-boost">
62<h1><a class="toc-backref" href="#id28">1&nbsp;&nbsp;&nbsp;Get Boost</a></h1>
63<p>The most reliable way to get a copy of Boost is to
64download <a class="reference external" href="http://www.boost.org/users/history/version_1_73_0.html"><tt class="docutils literal">boost_1_73_0</tt><tt class="docutils literal">.7z</tt></a> or <a class="reference external" href="http://www.boost.org/users/history/version_1_73_0.html"><tt class="docutils literal">boost_1_73_0</tt><tt class="docutils literal">.zip</tt></a> and unpack it to install a complete Boost
65distribution.<a class="footnote-reference" href="#zip" id="id2"><sup>1</sup></a></p>
66<!-- Copyright David Abrahams 2006. Distributed under the Boost -->
67<!-- Software License, Version 1.0. (See accompanying -->
68<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
69</div>
70<div class="section" id="the-boost-distribution">
71<h1><a class="toc-backref" href="#id29">2&nbsp;&nbsp;&nbsp;The Boost Distribution</a></h1>
72<p>This is a sketch of the resulting directory structure:</p>
73<pre class="literal-block">
74<strong>boost_1_73_0</strong><strong>\</strong> .................<em>The “boost root directory”</em>
75   <strong>index.htm</strong> .........<em>A copy of www.boost.org starts here</em>
76   <strong>boost</strong><strong>\</strong> .........................<em>All Boost Header files</em>
77   <strong>lib</strong><strong>\</strong> .....................<em>precompiled library binaries</em>
78   <strong>libs</strong><strong>\</strong> ............<em>Tests, .cpp</em>s<em>, docs, etc., by library</em>
79     <strong>index.html</strong> ........<em>Library documentation starts here</em>
80     <strong>algorithm</strong><strong>\</strong>
81     <strong>any</strong><strong>\</strong>
82     <strong>array</strong><strong>\</strong>
83                     <em>…more libraries…</em>
84   <strong>status</strong><strong>\</strong> .........................<em>Boost-wide test suite</em>
85   <strong>tools</strong><strong>\</strong> ...........<em>Utilities, e.g. Boost.Build, quickbook, bcp</em>
86   <strong>more</strong><strong>\</strong> ..........................<em>Policy documents, etc.</em>
87   <strong>doc</strong><strong>\</strong> ...............<em>A subset of all Boost library docs</em>
88</pre>
89<div class="sidebar">
90<p class="first sidebar-title">Header Organization</p>
91<p class="pre-wrap">The organization of Boost library headers isn't entirely uniform,
92but most libraries follow a few patterns:</p>
93<ul class="pre-wrap last">
94<li><p class="first">Some older libraries and most very small libraries place all
95public headers directly into <tt class="docutils literal">boost</tt><tt class="docutils literal">\</tt>.</p>
96</li>
97<li><p class="first">Most libraries' public headers live in a subdirectory of
98<tt class="docutils literal">boost</tt><tt class="docutils literal">\</tt>, named after the library.  For example, you'll find
99the Python library's <tt class="docutils literal">def.hpp</tt> header in</p>
100<pre class="literal-block">
101<tt class="docutils literal">boost</tt><tt class="docutils literal">\</tt><tt class="docutils literal">python</tt><tt class="docutils literal">\</tt><tt class="docutils literal">def.hpp</tt>.
102</pre>
103</li>
104<li><p class="first">Some libraries have an “aggregate header” in <tt class="docutils literal">boost</tt><tt class="docutils literal">\</tt> that
105<tt class="docutils literal">#include</tt>s all of the library's other headers.  For
106example, <a class="reference external" href="../../libs/python/doc/html/building.html">Boost.Python</a>'s aggregate header is</p>
107<pre class="literal-block">
108<tt class="docutils literal">boost</tt><tt class="docutils literal">\</tt><tt class="docutils literal">python.hpp</tt>.
109</pre>
110</li>
111<li><p class="first">Most libraries place private headers in a subdirectory called
112<tt class="docutils literal">detail</tt><tt class="docutils literal">\</tt>, or <tt class="docutils literal">aux_</tt><tt class="docutils literal">\</tt>.  Don't expect to find
113anything you can use in these directories.</p>
114</li>
115</ul>
116</div>
117<p>It's important to note the following:</p>
118<ol class="arabic" id="boost-root-directory">
119<li><p class="first">The path to the <strong>boost root directory</strong> (often <tt class="docutils literal"><span class="pre">C:\Program</span> Files\boost\</tt><tt class="docutils literal">boost_1_73_0</tt>) is
120sometimes referred to as <tt class="docutils literal">$BOOST_ROOT</tt> in documentation and
121mailing lists .</p>
122</li>
123<li><p class="first">To compile anything in Boost, you need a directory containing
124the <tt class="docutils literal">boost</tt><tt class="docutils literal">\</tt> subdirectory in your <tt class="docutils literal">#include</tt> path.  Specific steps for setting up <tt class="docutils literal">#include</tt>
125paths in Microsoft Visual Studio follow later in this document;
126if you use another IDE, please consult your product's
127documentation for instructions.</p>
128</li>
129<li><p class="first">Since all of Boost's header files have the <tt class="docutils literal">.hpp</tt> extension,
130and live in the <tt class="docutils literal">boost</tt><tt class="docutils literal">\</tt> subdirectory of the boost root, your
131Boost <tt class="docutils literal">#include</tt> directives will look like:</p>
132<pre class="literal-block">
133#include &lt;boost/<em>whatever</em>.hpp&gt;
134</pre>
135<p>or</p>
136<pre class="literal-block">
137#include &quot;boost/<em>whatever</em>.hpp&quot;
138</pre>
139<p>depending on your preference regarding the use of angle bracket
140includes.  Even Windows users can (and, for
141portability reasons, probably should) use forward slashes in
142<tt class="docutils literal">#include</tt> directives; your compiler doesn't care.</p>
143</li>
144<li><p class="first">Don't be distracted by the <tt class="docutils literal">doc</tt><tt class="docutils literal">\</tt> subdirectory; it only
145contains a subset of the Boost documentation.  Start with
146<tt class="docutils literal">libs</tt><tt class="docutils literal">\</tt><tt class="docutils literal">index.html</tt> if you're looking for the whole enchilada.</p>
147</li>
148</ol>
149<!-- Copyright David Abrahams 2006. Distributed under the Boost -->
150<!-- Software License, Version 1.0. (See accompanying -->
151<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
152</div>
153<div class="section" id="header-only-libraries">
154<h1><a class="toc-backref" href="#id30">3&nbsp;&nbsp;&nbsp;Header-Only Libraries</a></h1>
155<p>The first thing many people want to know is, “how do I build
156Boost?”  The good news is that often, there's nothing to build.</p>
157<div class="admonition-nothing-to-build admonition">
158<p class="first admonition-title">Nothing to Build?</p>
159<p class="last">Most Boost libraries are <strong>header-only</strong>: they consist <em>entirely
160of header files</em> containing templates and inline functions, and
161require no separately-compiled library binaries or special
162treatment when linking.</p>
163</div>
164<!-- .. _separate: -->
165<p>The only Boost libraries that <em>must</em> be built separately are:</p>
166<ul class="simple">
167<li><a class="reference external" href="../../libs/chrono/index.html">Boost.Chrono</a></li>
168<li><a class="reference external" href="../../libs/context/index.html">Boost.Context</a></li>
169<li><a class="reference external" href="../../libs/filesystem/index.html">Boost.Filesystem</a></li>
170<li><a class="reference external" href="../../libs/graph_parallel/index.html">Boost.GraphParallel</a></li>
171<li><a class="reference external" href="../../libs/iostreams/index.html">Boost.IOStreams</a></li>
172<li><a class="reference external" href="../../libs/locale/index.html">Boost.Locale</a></li>
173<li><a class="reference external" href="../../libs/log/index.html">Boost.Log</a> (see <a class="reference external" href="../../libs/log/doc/html/log/installation/config.html">build documentation</a>)</li>
174<li><a class="reference external" href="../../libs/mpi/index.html">Boost.MPI</a></li>
175<li><a class="reference external" href="../../libs/program_options/index.html">Boost.ProgramOptions</a></li>
176<li><a class="reference external" href="../../libs/python/doc/html/building.html">Boost.Python</a> (see the <a class="reference external" href="../../libs/python/doc/html/building.html">Boost.Python build documentation</a>
177before building and installing it)</li>
178<li><a class="reference external" href="../../libs/regex/index.html">Boost.Regex</a></li>
179<li><a class="reference external" href="../../libs/serialization/index.html">Boost.Serialization</a></li>
180<li><a class="reference external" href="../../libs/thread/index.html">Boost.Thread</a></li>
181<li><a class="reference external" href="../../libs/timer/index.html">Boost.Timer</a></li>
182<li><a class="reference external" href="../../libs/wave/index.html">Boost.Wave</a></li>
183</ul>
184<p>A few libraries have optional separately-compiled binaries:</p>
185<ul class="simple">
186<li><a class="reference external" href="../../libs/graph/index.html">Boost.Graph</a> also has a binary component that is only needed if
187you intend to <a class="reference external" href="../../libs/graph/doc/read_graphviz.html">parse GraphViz files</a>.</li>
188<li><a class="reference external" href="../../libs/math/index.html">Boost.Math</a> has binary components for the TR1 and C99
189cmath functions.</li>
190<li><a class="reference external" href="../../libs/random/index.html">Boost.Random</a> has a binary component which is only needed if
191you're using <tt class="docutils literal">random_device</tt>.</li>
192<li><a class="reference external" href="../../libs/test/index.html">Boost.Test</a> can be used in “header-only” or “separately compiled”
193mode, although <strong>separate compilation is recommended for serious
194use</strong>.</li>
195<li><a class="reference external" href="../../libs/exception/index.html">Boost.Exception</a> provides non-intrusive implementation of
196exception_ptr for 32-bit _MSC_VER==1310 and _MSC_VER==1400
197which requires a separately-compiled binary. This is enabled by
198#define BOOST_ENABLE_NON_INTRUSIVE_EXCEPTION_PTR.</li>
199<li><a class="reference external" href="../../libs/system/index.html">Boost.System</a> is header-only since Boost 1.69. A stub library is
200still built for compatibility, but linking to it is no longer
201necessary.</li>
202</ul>
203<!-- Copyright David Abrahams 2006. Distributed under the Boost -->
204<!-- Software License, Version 1.0. (See accompanying -->
205<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
206</div>
207<div class="section" id="build-a-simple-program-using-boost">
208<h1><a class="toc-backref" href="#id31">4&nbsp;&nbsp;&nbsp;Build a Simple Program Using Boost</a></h1>
209<p>To keep things simple, let's start by using a header-only library.
210The following program reads a sequence of integers from standard
211input, uses Boost.Lambda to multiply each number by three, and
212writes them to standard output:</p>
213<pre class="literal-block">
214#include &lt;boost/lambda/lambda.hpp&gt;
215#include &lt;iostream&gt;
216#include &lt;iterator&gt;
217#include &lt;algorithm&gt;
218
219int main()
220{
221    using namespace boost::lambda;
222    typedef std::istream_iterator&lt;int&gt; in;
223
224    std::for_each(
225        in(std::cin), in(), std::cout &lt;&lt; (_1 * 3) &lt;&lt; &quot; &quot; );
226}
227</pre>
228<p>Copy the text of this program into a file called <tt class="docutils literal">example.cpp</tt>.</p>
229<div class="note" id="command-line-tool">
230<span id="command-prompt"></span><p class="first admonition-title">Note</p>
231<p class="last">To build the examples in this guide, you can use an
232Integrated Development Environment (IDE) like Visual Studio, or
233you can issue commands from the <a class="reference internal" href="#command-prompt">command prompt</a>.  Since every
234IDE and compiler has different options and Microsoft's are by
235far the dominant compilers on Windows, we only give specific
236directions here for Visual Studio 2005 and .NET 2003 IDEs and
237their respective command prompt compilers (using the command
238prompt is a bit simpler).  If you are using another compiler or
239IDE, it should be relatively easy to adapt these instructions to
240your environment.</p>
241</div>
242<div class="small sidebar">
243<p class="first sidebar-title">Command Prompt Basics</p>
244<p>In Windows, a command-line tool is invoked by typing its name,
245optionally followed by arguments, into a <em>Command Prompt</em> window
246and pressing the Return (or Enter) key.</p>
247<p>To open a generic <em>Command Prompt</em>, click the <em>Start</em> menu
248button, click <em>Run</em>, type “cmd”, and then click <em>OK</em>.</p>
249<p id="current-directory">All commands are executed within the context of a <strong>current
250directory</strong> in the filesystem.  To set the current directory,
251type:</p>
252<pre class="literal-block">
253cd <em>path</em>\<em>to</em>\<em>some</em>\<em>directory</em>
254</pre>
255<p>followed by Return.  For example,</p>
256<pre class="literal-block">
257cd <tt class="docutils literal"><span class="pre">C:\Program</span> Files\boost\</tt><tt class="docutils literal">boost_1_73_0</tt>
258</pre>
259<p class="last">Long commands can be continued across several lines by typing a
260caret (<tt class="docutils literal">^</tt>) at the end of all but the last line.  Some examples
261on this page use that technique to save horizontal space.</p>
262</div>
263<div class="section" id="build-from-the-visual-studio-ide">
264<span id="vs-header-only"></span><h2><a class="toc-backref" href="#id32">4.1&nbsp;&nbsp;&nbsp;Build From the Visual Studio IDE</a></h2>
265<ul>
266<li><p class="first">From Visual Studio's <em>File</em> menu, select <em>New</em> &gt; <em>Project…</em></p>
267</li>
268<li><p class="first">In the left-hand pane of the resulting <em>New Project</em> dialog,
269select <em>Visual C++</em> &gt; <em>Win32</em>.</p>
270</li>
271<li><p class="first">In the right-hand pane, select <em>Win32 Console Application</em>
272(VS8.0) or <em>Win32 Console Project</em> (VS7.1).</p>
273</li>
274<li><p class="first">In the <em>name</em> field, enter “example”</p>
275</li>
276<li><p class="first">Right-click <strong>example</strong> in the <em>Solution Explorer</em> pane and
277select <em>Properties</em> from the resulting pop-up menu</p>
278</li>
279<li><p class="first">In <em>Configuration Properties</em> &gt; <em>C/C++</em> &gt; <em>General</em> &gt; <em>Additional Include
280Directories</em>, enter the path to the Boost root directory, for example</p>
281<blockquote>
282<p><tt class="docutils literal"><span class="pre">C:\Program</span> Files\boost\</tt><tt class="docutils literal">boost_1_73_0</tt></p>
283</blockquote>
284</li>
285<li><p class="first">In <em>Configuration Properties</em> &gt; <em>C/C++</em> &gt; <em>Precompiled Headers</em>, change
286<em>Use Precompiled Header (/Yu)</em> to <em>Not Using Precompiled
287Headers</em>.<a class="footnote-reference" href="#pch" id="id6"><sup>2</sup></a></p>
288</li>
289<li><p class="first">Replace the contents of the <tt class="docutils literal">example.cpp</tt> generated by the IDE
290with the example code above.</p>
291</li>
292<li><p class="first">From the <em>Build</em> menu, select <em>Build Solution</em>.</p>
293</li>
294</ul>
295<p>To test your application, hit the F5 key and type the following
296into the resulting window, followed by the Return key:</p>
297<pre class="literal-block">
2981 2 3
299</pre>
300<p>Then hold down the control key and press &quot;Z&quot;, followed by the
301Return key.</p>
302<p><a class="reference internal" href="#errors-and-warnings"><em>skip to the next step</em></a></p>
303</div>
304<div class="section" id="or-build-from-the-command-prompt">
305<h2><a class="toc-backref" href="#id33">4.2&nbsp;&nbsp;&nbsp;Or, Build From the Command Prompt</a></h2>
306<p>From your computer's <em>Start</em> menu, if you are a Visual
307Studio 2005 user, select</p>
308<blockquote>
309<em>All Programs</em> &gt; <em>Microsoft Visual Studio 2005</em>
310&gt; <em>Visual Studio Tools</em> &gt; <em>Visual Studio 2005 Command Prompt</em></blockquote>
311<p>or, if you're a Visual Studio .NET 2003 user, select</p>
312<blockquote>
313<em>All Programs</em> &gt; <em>Microsoft Visual Studio .NET 2003</em>
314&gt; <em>Visual Studio .NET Tools</em> &gt; <em>Visual Studio .NET 2003 Command Prompt</em></blockquote>
315<p>to bring up a special <a class="reference internal" href="#command-prompt">command prompt</a> window set up for the
316Visual Studio compiler.  In that window, set the <a class="reference internal" href="#current-directory">current
317directory</a> to a suitable location for creating some temporary
318files and type the following command followed by the Return key:</p>
319<pre class="literal-block">
320cl /EHsc /I <em>path\to\</em><tt class="docutils literal">boost_1_73_0</tt> <em>path</em>\<em>to</em>\example.cpp
321</pre>
322<p>To test the result, type:</p>
323<pre class="literal-block">
324echo 1 2 3 | example
325</pre>
326<!-- Copyright David Abrahams 2006. Distributed under the Boost -->
327<!-- Software License, Version 1.0. (See accompanying -->
328<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
329</div>
330<div class="section" id="errors-and-warnings">
331<h2><a class="toc-backref" href="#id34">4.3&nbsp;&nbsp;&nbsp;Errors and Warnings</a></h2>
332<p>Don't be alarmed if you see compiler warnings originating in Boost
333headers.  We try to eliminate them, but doing so isn't always
334practical.<a class="footnote-reference" href="#warnings" id="id8"><sup>4</sup></a> <strong>Errors are another matter</strong>.  If you're
335seeing compilation errors at this point in the tutorial, check to
336be sure you've copied the <a class="reference internal" href="#build-a-simple-program-using-boost">example program</a> correctly and that you've
337correctly identified the <a class="reference internal" href="#boost-root-directory">Boost root directory</a>.</p>
338<!-- Copyright David Abrahams 2006. Distributed under the Boost -->
339<!-- Software License, Version 1.0. (See accompanying -->
340<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
341</div>
342</div>
343<div class="section" id="prepare-to-use-a-boost-library-binary">
344<h1><a class="toc-backref" href="#id35">5&nbsp;&nbsp;&nbsp;Prepare to Use a Boost Library Binary</a></h1>
345<p>If you want to use any of the separately-compiled Boost libraries,
346you'll need to acquire library binaries.</p>
347<div class="section" id="simplified-build-from-source">
348<h2><a class="toc-backref" href="#id36">5.1&nbsp;&nbsp;&nbsp;Simplified Build From Source</a></h2>
349<p>If you wish to build from source with Visual C++, you can use a
350simple build procedure described in this section. Open the command prompt
351and change your current directory to the Boost root directory. Then, type
352the following commands:</p>
353<pre class="literal-block">
354bootstrap
355.\b2
356</pre>
357<p>The first command prepares the Boost.Build system for use. The second
358command invokes Boost.Build to build the separately-compiled Boost
359libraries. Please consult the <a class="reference external" href="http://www.boost.org/build/doc/html/bbv2/overview/invocation.html">Boost.Build documentation</a> for a list
360of allowed options.</p>
361</div>
362<div class="section" id="or-build-binaries-from-source">
363<h2><a class="toc-backref" href="#id37">5.2&nbsp;&nbsp;&nbsp;Or, Build Binaries From Source</a></h2>
364<p>If you're using an earlier version of Visual C++, or a compiler
365from another vendor, you'll need to use <a class="reference external" href="../../tools/build/index.html">Boost.Build</a> to create your
366own binaries.</p>
367<!-- Copyright David Abrahams 2006. Distributed under the Boost -->
368<!-- Software License, Version 1.0. (See accompanying -->
369<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
370<div class="section" id="install-boost-build">
371<h3><a class="toc-backref" href="#id38">5.2.1&nbsp;&nbsp;&nbsp;Install Boost.Build</a></h3>
372<p><a class="reference external" href="../../tools/build/index.html">Boost.Build</a> is a text-based system for developing, testing, and
373installing software. First, you'll need to build and
374install it. To do this:</p>
375<ol class="arabic simple">
376<li>Go to the directory <tt class="docutils literal">tools</tt><tt class="docutils literal">\</tt><tt class="docutils literal">build</tt><tt class="docutils literal">\</tt>.</li>
377<li>Run <tt class="docutils literal">bootstrap.bat</tt></li>
378<li>Run <tt class="docutils literal">b2 install <span class="pre">--prefix=</span></tt><em>PREFIX</em> where <em>PREFIX</em> is
379the directory where you want Boost.Build to be installed</li>
380<li>Add <em>PREFIX</em><tt class="docutils literal">\</tt><tt class="docutils literal">bin</tt> to your PATH environment variable.</li>
381</ol>
382</div>
383<div class="section" id="identify-your-toolset">
384<span id="toolset-name"></span><span id="toolset"></span><h3><a class="toc-backref" href="#id39">5.2.2&nbsp;&nbsp;&nbsp;Identify Your Toolset</a></h3>
385<p>First, find the toolset corresponding to your compiler in the
386following table (an up-to-date list is always available <a class="reference external" href="http://www.boost.org/build/doc/html/bbv2/reference/tools.html">in the
387Boost.Build documentation</a>).</p>
388<div class="note">
389<p class="first admonition-title">Note</p>
390<p class="last">If you previously chose a toolset for the purposes of
391<a class="reference external" href="../../doc/html/bbv2/installation.html">building b2</a>, you should assume it won't work and instead
392choose newly from the table below.</p>
393</div>
394<table border="1" class="docutils">
395<colgroup>
396<col width="12%" />
397<col width="22%" />
398<col width="66%" />
399</colgroup>
400<thead valign="bottom">
401<tr><th class="head">Toolset
402Name</th>
403<th class="head">Vendor</th>
404<th class="head">Notes</th>
405</tr>
406</thead>
407<tbody valign="top">
408<tr><td><tt class="docutils literal">acc</tt></td>
409<td>Hewlett Packard</td>
410<td>Only very recent versions are known to work well with Boost</td>
411</tr>
412<tr><td><tt class="docutils literal">borland</tt></td>
413<td>Borland</td>
414<td>&nbsp;</td>
415</tr>
416<tr><td><tt class="docutils literal">como</tt></td>
417<td>Comeau Computing</td>
418<td>Using this toolset may require <a class="reference external" href="../../tools/build/index.html">configuring</a> another
419toolset to act as its backend.</td>
420</tr>
421<tr><td><tt class="docutils literal">darwin</tt></td>
422<td>Apple Computer</td>
423<td>Apple's version of the GCC toolchain with support for
424Darwin and MacOS X features such as frameworks.</td>
425</tr>
426<tr><td><tt class="docutils literal">gcc</tt></td>
427<td>The Gnu Project</td>
428<td>Includes support for Cygwin and MinGW compilers.</td>
429</tr>
430<tr><td><tt class="docutils literal">hp_cxx</tt></td>
431<td>Hewlett Packard</td>
432<td>Targeted at the Tru64 operating system.</td>
433</tr>
434<tr><td><tt class="docutils literal">intel</tt></td>
435<td>Intel</td>
436<td>&nbsp;</td>
437</tr>
438<tr><td><tt class="docutils literal">msvc</tt></td>
439<td>Microsoft</td>
440<td>&nbsp;</td>
441</tr>
442<tr><td><tt class="docutils literal">sun</tt></td>
443<td>Oracle</td>
444<td>Only very recent versions are known to work well with
445Boost.  Note that the Oracle/Sun compiler has a large number
446of options which effect binary compatibility: it is vital
447that the libraries are built with the same options that your
448appliction will use. In particular be aware that the default
449standard library may not work well with Boost, <em>unless you
450are building for C++11</em>. The particular compiler options you
451need can be injected with the b2 command line options
452<tt class="docutils literal"><span class="pre">cxxflags=``and</span> ``linkflags=</tt>.  For example to build with
453the Apache standard library in C++03 mode use
454<tt class="docutils literal">b2 <span class="pre">cxxflags=-library=stdcxx4</span> <span class="pre">linkflags=-library=stdcxx4</span></tt>.</td>
455</tr>
456<tr><td><tt class="docutils literal">vacpp</tt></td>
457<td>IBM</td>
458<td>The VisualAge C++ compiler.</td>
459</tr>
460</tbody>
461</table>
462<p>If you have multiple versions of a particular compiler installed,
463you can append the version number to the toolset name, preceded by
464a hyphen, e.g. <tt class="docutils literal"><span class="pre">intel-9.0</span></tt> or
465<tt class="docutils literal"><span class="pre">borland-5.4.3</span></tt>. <strong>On Windows, append a version
466number even if you only have one version installed</strong> (unless you
467are using the msvc or gcc toolsets, which have special version
468detection code) or <a class="reference internal" href="#auto-linking">auto-linking</a> will fail.</p>
469</div>
470<div class="section" id="select-a-build-directory">
471<span id="id13"></span><span id="build-directory"></span><h3><a class="toc-backref" href="#id40">5.2.3&nbsp;&nbsp;&nbsp;Select a Build Directory</a></h3>
472<p><a class="reference external" href="../../tools/build/index.html">Boost.Build</a> will place all intermediate files it generates while
473building into the <strong>build directory</strong>.  If your Boost root
474directory is writable, this step isn't strictly necessary: by
475default Boost.Build will create a <tt class="docutils literal">bin.v2/</tt> subdirectory for that
476purpose in your current working directory.</p>
477</div>
478<div class="section" id="invoke-b2">
479<h3><a class="toc-backref" href="#id41">5.2.4&nbsp;&nbsp;&nbsp;Invoke <tt class="docutils literal">b2</tt></a></h3>
480<p>Change your current directory to the Boost root directory and
481invoke <tt class="docutils literal">b2</tt> as follows:</p>
482<pre class="literal-block">
483b2 <strong>--build-dir=</strong><a class="reference internal" href="#id13"><em>build-directory</em></a> <strong>toolset=</strong><a class="reference internal" href="#toolset-name"><em>toolset-name</em></a> <strong>--build-type=complete</strong> stage
484</pre>
485<p>For a complete description of these and other invocation options,
486please see the <a class="reference external" href="http://www.boost.org/build/doc/html/bbv2/overview/invocation.html">Boost.Build documentation</a>.</p>
487<p>For example, your session might look like this:<a class="footnote-reference" href="#continuation" id="id15"><sup>3</sup></a></p>
488<pre class="literal-block">
489C:\WINDOWS&gt; cd <tt class="docutils literal"><span class="pre">C:\Program</span> Files\boost\</tt><tt class="docutils literal">boost_1_73_0</tt>
490<tt class="docutils literal"><span class="pre">C:\Program</span> Files\boost\</tt><tt class="docutils literal">boost_1_73_0</tt>&gt; b2 <strong>^</strong>
491More? <strong>--build-dir=</strong>&quot;C:\Documents and Settings\dave\build-boost&quot; <strong>^</strong>
492More? <strong>--build-type=complete</strong> <strong>msvc</strong> stage
493</pre>
494<p>Be sure to read <a class="reference internal" href="#continuation">this note</a> about the appearance of <tt class="docutils literal">^</tt>,
495<tt class="docutils literal">More?</tt> and quotation marks (<tt class="docutils literal">&quot;</tt>) in that line.</p>
496<p>The option “<strong>--build-type=complete</strong>” causes Boost.Build to build
497all supported variants of the libraries.  For instructions on how to
498build only specific variants, please ask on the <a class="reference external" href="http://www.boost.org/more/mailing_lists.htm#jamboost">Boost.Build mailing
499list</a>.</p>
500<!-- Copyright David Abrahams 2006. Distributed under the Boost -->
501<!-- Software License, Version 1.0. (See accompanying -->
502<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
503<p>Building the special <tt class="docutils literal">stage</tt> target places Boost
504library binaries in the <tt class="docutils literal">stage</tt><tt class="docutils literal">\</tt><tt class="docutils literal">lib</tt><tt class="docutils literal">\</tt> subdirectory of
505the Boost tree.  To use a different directory pass the
506<tt class="docutils literal"><span class="pre">--stagedir=</span></tt><em>directory</em> option to <tt class="docutils literal">b2</tt>.</p>
507<div class="note">
508<p class="first admonition-title">Note</p>
509<p class="last"><tt class="docutils literal">b2</tt> is case-sensitive; it is important that all the
510parts shown in <strong>bold</strong> type above be entirely lower-case.</p>
511</div>
512<p>For a description of other options you can pass when invoking
513<tt class="docutils literal">b2</tt>, type:</p>
514<pre class="literal-block">
515b2 --help
516</pre>
517<p>In particular, to limit the amount of time spent building, you may
518be interested in:</p>
519<ul class="simple">
520<li>reviewing the list of library names with <tt class="docutils literal"><span class="pre">--show-libraries</span></tt></li>
521<li>limiting which libraries get built with the <tt class="docutils literal"><span class="pre">--with-</span></tt><em>library-name</em> or <tt class="docutils literal"><span class="pre">--without-</span></tt><em>library-name</em> options</li>
522<li>choosing a specific build variant by adding <tt class="docutils literal">release</tt> or
523<tt class="docutils literal">debug</tt> to the command line.</li>
524</ul>
525<div class="note">
526<p class="first admonition-title">Note</p>
527<p class="last">Boost.Build can produce a great deal of output, which can
528make it easy to miss problems.  If you want to make sure
529everything is went well, you might redirect the output into a
530file by appending “<tt class="docutils literal">&gt;build.log <span class="pre">2&gt;&amp;1</span></tt>” to your command line.</p>
531</div>
532</div>
533</div>
534<div class="section" id="expected-build-output">
535<h2><a class="toc-backref" href="#id42">5.3&nbsp;&nbsp;&nbsp;Expected Build Output</a></h2>
536<p>During the process of building Boost libraries, you can expect to
537see some messages printed on the console.  These may include</p>
538<ul>
539<li><p class="first">Notices about Boost library configuration—for example, the Regex
540library outputs a message about ICU when built without Unicode
541support, and the Python library may be skipped without error (but
542with a notice) if you don't have Python installed.</p>
543</li>
544<li><p class="first">Messages from the build tool that report the number of targets
545that were built or skipped.  Don't be surprised if those numbers
546don't make any sense to you; there are many targets per library.</p>
547</li>
548<li><p class="first">Build action messages describing what the tool is doing, which
549look something like:</p>
550<pre class="literal-block">
551<em>toolset-name</em>.c++ <em>long</em>/<em>path</em>/<em>to</em>/<em>file</em>/<em>being</em>/<em>built</em>
552</pre>
553</li>
554<li><p class="first">Compiler warnings.</p>
555</li>
556</ul>
557</div>
558<div class="section" id="in-case-of-build-errors">
559<h2><a class="toc-backref" href="#id43">5.4&nbsp;&nbsp;&nbsp;In Case of Build Errors</a></h2>
560<p>The only error messages you see when building Boost—if any—should
561be related to the IOStreams library's support of zip and bzip2
562formats as described <a class="reference external" href="../../libs/iostreams/doc/installation.html">here</a>.  Install the relevant development
563packages for libz and libbz2 if you need those features.  Other
564errors when building Boost libraries are cause for concern.</p>
565<p>If it seems like the build system can't find your compiler and/or
566linker, consider setting up a <tt class="docutils literal"><span class="pre">user-config.jam</span></tt> file as described
567<a class="reference external" href="http://www.boost.org/build/doc/html/bbv2/overview/configuration.html">here</a>.  If that isn't your problem or the <tt class="docutils literal"><span class="pre">user-config.jam</span></tt> file
568doesn't work for you, please address questions about configuring Boost
569for your compiler to the <a class="reference external" href="http://www.boost.org/more/mailing_lists.htm#jamboost">Boost.Build mailing list</a>.</p>
570<span class="target" id="auto-linking"></span><!-- Copyright David Abrahams 2006. Distributed under the Boost -->
571<!-- Software License, Version 1.0. (See accompanying -->
572<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
573</div>
574</div>
575<div class="section" id="link-your-program-to-a-boost-library">
576<h1><a class="toc-backref" href="#id44">6&nbsp;&nbsp;&nbsp;Link Your Program to a Boost Library</a></h1>
577<p>To demonstrate linking with a Boost binary library, we'll use the
578following simple program that extracts the subject lines from
579emails.  It uses the <a class="reference external" href="../../libs/regex/index.html">Boost.Regex</a> library, which has a
580separately-compiled binary component.</p>
581<pre class="literal-block">
582#include &lt;boost/regex.hpp&gt;
583#include &lt;iostream&gt;
584#include &lt;string&gt;
585
586int main()
587{
588    std::string line;
589    boost::regex pat( &quot;^Subject: (Re: |Aw: )*(.*)&quot; );
590
591    while (std::cin)
592    {
593        std::getline(std::cin, line);
594        boost::smatch matches;
595        if (boost::regex_match(line, matches, pat))
596            std::cout &lt;&lt; matches[2] &lt;&lt; std::endl;
597    }
598}
599</pre>
600<p>There are two main challenges associated with linking:</p>
601<ol class="arabic simple">
602<li>Tool configuration, e.g. choosing command-line options or IDE
603build settings.</li>
604<li>Identifying the library binary, among all the build variants,
605whose compile configuration is compatible with the rest of your
606project.</li>
607</ol>
608<div class="admonition-auto-linking admonition">
609<p class="first admonition-title">Auto-Linking</p>
610<p>Most Windows compilers and linkers have so-called “auto-linking
611support,” which eliminates the second challenge.  Special code in
612Boost header files detects your compiler options and uses that
613information to encode the name of the correct library into your
614object files; the linker selects the library with that name from
615the directories you've told it to search.</p>
616<p class="last">The GCC toolchains (Cygwin and MinGW) are notable exceptions;
617GCC users should refer to the <a class="reference external" href="unix-variants.html#link-your-program-to-a-boost-library">linking instructions for Unix
618variant OSes</a> for the appropriate command-line options to use.</p>
619</div>
620<div class="section" id="link-from-within-the-visual-studio-ide">
621<h2><a class="toc-backref" href="#id45">6.1&nbsp;&nbsp;&nbsp;Link From Within the Visual Studio IDE</a></h2>
622<p>Starting with the <a class="reference internal" href="#vs-header-only">header-only example project</a> we created
623earlier:</p>
624<ol class="arabic simple">
625<li>Right-click <strong>example</strong> in the <em>Solution Explorer</em> pane and
626select <em>Properties</em> from the resulting pop-up menu</li>
627<li>In <em>Configuration Properties</em> &gt; <em>Linker</em> &gt; <em>Additional Library
628Directories</em>, enter the path to the Boost binaries,
629e.g. <tt class="docutils literal"><span class="pre">C:\Program</span> Files\boost\</tt><tt class="docutils literal">boost_1_73_0</tt><tt class="docutils literal">\lib\</tt>.</li>
630<li>From the <em>Build</em> menu, select <em>Build Solution</em>.</li>
631</ol>
632<p><a class="reference internal" href="#test-your-program"><em>skip to the next step</em></a></p>
633</div>
634<div class="section" id="or-link-from-the-command-prompt">
635<h2><a class="toc-backref" href="#id46">6.2&nbsp;&nbsp;&nbsp;Or, Link From the Command Prompt</a></h2>
636<p>For example, we can compile and link the above program from the
637Visual C++ command-line by simply adding the <strong>bold</strong> text below to
638the command line we used earlier, assuming your Boost binaries are
639in <tt class="docutils literal"><span class="pre">C:\Program</span> Files\boost\</tt><tt class="docutils literal">boost_1_73_0</tt><tt class="docutils literal">\lib</tt>:</p>
640<pre class="literal-block">
641cl /EHsc /I <em>path\to\</em><tt class="docutils literal">boost_1_73_0</tt> example.cpp   <strong>^</strong>
642     <strong>/link /LIBPATH:</strong><strong>C:\Program Files\boost\</strong><strong>boost_1_73_0</strong><strong>\lib</strong>
643</pre>
644</div>
645<div class="section" id="library-naming">
646<h2><a class="toc-backref" href="#id47">6.3&nbsp;&nbsp;&nbsp;Library Naming</a></h2>
647<div class="note">
648<p class="first admonition-title">Note</p>
649<p>If, like Visual C++, your compiler supports auto-linking,
650you can probably <a class="reference internal" href="#test-your-program"><em>skip to the next step</em></a>.</p>
651<blockquote class="last">
652</blockquote>
653</div>
654<!-- Copyright David Abrahams 2006. Distributed under the Boost -->
655<!-- Software License, Version 1.0. (See accompanying -->
656<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
657<p>In order to choose the right binary for your build configuration
658you need to know how Boost binaries are named.  Each library
659filename is composed of a common sequence of elements that describe
660how it was built.  For example,
661<tt class="docutils literal"><span class="pre">libboost_regex-vc71-mt-d-x86-1_34.lib</span></tt> can be broken down into the
662following elements:</p>
663<dl class="docutils">
664<dt><tt class="docutils literal">lib</tt></dt>
665<dd><em>Prefix</em>: except on Microsoft Windows, every Boost library
666name begins with this string.  On Windows, only ordinary static
667libraries use the <tt class="docutils literal">lib</tt> prefix; import libraries and DLLs do
668not.<a class="footnote-reference" href="#distinct" id="id23"><sup>5</sup></a></dd>
669<dt><tt class="docutils literal">boost_regex</tt></dt>
670<dd><em>Library name</em>: all boost library filenames begin with <tt class="docutils literal">boost_</tt>.</dd>
671<dt><tt class="docutils literal"><span class="pre">-vc71</span></tt></dt>
672<dd><em>Toolset tag</em>: identifies the <a class="reference internal" href="#toolset">toolset</a> and version used to build
673the binary.</dd>
674<dt><tt class="docutils literal"><span class="pre">-mt</span></tt></dt>
675<dd><em>Threading tag</em>: indicates that the library was
676built with multithreading support enabled.  Libraries built
677without multithreading support can be identified by the absence
678of <tt class="docutils literal"><span class="pre">-mt</span></tt>.</dd>
679<dt><tt class="docutils literal"><span class="pre">-d</span></tt></dt>
680<dd><p class="first"><em>ABI tag</em>: encodes details that affect the library's
681interoperability with other compiled code.  For each such
682feature, a single letter is added to the tag:</p>
683<blockquote>
684<table border="1" class="docutils">
685<colgroup>
686<col width="5%" />
687<col width="75%" />
688<col width="20%" />
689</colgroup>
690<thead valign="bottom">
691<tr><th class="head">Key</th>
692<th class="head">Use this library when:</th>
693<th class="head">Boost.Build option</th>
694</tr>
695</thead>
696<tbody valign="top">
697<tr><td><tt class="docutils literal">s</tt></td>
698<td>linking statically to the C++ standard library and compiler runtime support
699libraries.</td>
700<td>runtime-link=static</td>
701</tr>
702<tr><td><tt class="docutils literal">g</tt></td>
703<td>using debug versions of the standard and runtime support libraries.</td>
704<td>runtime-debugging=on</td>
705</tr>
706<tr><td><tt class="docutils literal">y</tt></td>
707<td>using a special <a class="reference external" href="../../libs/python/doc/html/building/python_debugging_builds.html">debug build of Python</a>.</td>
708<td>python-debugging=on</td>
709</tr>
710<tr><td><tt class="docutils literal">d</tt></td>
711<td>building a debug version of your code.<a class="footnote-reference" href="#debug-abi" id="id24"><sup>6</sup></a></td>
712<td>variant=debug</td>
713</tr>
714<tr><td><tt class="docutils literal">p</tt></td>
715<td>using the STLPort standard library rather than the default one supplied with
716your compiler.</td>
717<td>stdlib=stlport</td>
718</tr>
719</tbody>
720</table>
721</blockquote>
722<p class="last">For example, if you build a debug version of your code for use
723with debug versions of the static runtime library and the
724STLPort standard library,
725the tag would be: <tt class="docutils literal"><span class="pre">-sgdp</span></tt>.  If none of the above apply, the
726ABI tag is ommitted.</p>
727</dd>
728<dt><tt class="docutils literal"><span class="pre">-x86</span></tt></dt>
729<dd><p class="first"><em>Architecture and address model tag</em>: in the first letter, encodes the architecture as follows:</p>
730<blockquote>
731<table border="1" class="docutils">
732<colgroup>
733<col width="11%" />
734<col width="41%" />
735<col width="48%" />
736</colgroup>
737<thead valign="bottom">
738<tr><th class="head">Key</th>
739<th class="head">Architecture</th>
740<th class="head">Boost.Build option</th>
741</tr>
742</thead>
743<tbody valign="top">
744<tr><td><tt class="docutils literal">x</tt></td>
745<td>x86-32, x86-64</td>
746<td>architecture=x86</td>
747</tr>
748<tr><td><tt class="docutils literal">a</tt></td>
749<td>ARM</td>
750<td>architecture=arm</td>
751</tr>
752<tr><td><tt class="docutils literal">i</tt></td>
753<td>IA-64</td>
754<td>architecture=ia64</td>
755</tr>
756<tr><td><tt class="docutils literal">s</tt></td>
757<td>Sparc</td>
758<td>architecture=sparc</td>
759</tr>
760<tr><td><tt class="docutils literal">m</tt></td>
761<td>MIPS/SGI</td>
762<td>architecture=mips*</td>
763</tr>
764<tr><td><tt class="docutils literal">p</tt></td>
765<td>RS/6000 &amp; PowerPC</td>
766<td>architecture=power</td>
767</tr>
768</tbody>
769</table>
770</blockquote>
771<p>The two digits following the letter encode the address model as follows:</p>
772<blockquote class="last">
773<table border="1" class="docutils">
774<colgroup>
775<col width="13%" />
776<col width="40%" />
777<col width="47%" />
778</colgroup>
779<thead valign="bottom">
780<tr><th class="head">Key</th>
781<th class="head">Address model</th>
782<th class="head">Boost.Build option</th>
783</tr>
784</thead>
785<tbody valign="top">
786<tr><td><tt class="docutils literal">32</tt></td>
787<td>32 bit</td>
788<td>address-model=32</td>
789</tr>
790<tr><td><tt class="docutils literal">64</tt></td>
791<td>64 bit</td>
792<td>address-model=64</td>
793</tr>
794</tbody>
795</table>
796</blockquote>
797</dd>
798<dt><tt class="docutils literal"><span class="pre">-1_34</span></tt></dt>
799<dd><em>Version tag</em>: the full Boost release number, with periods
800replaced by underscores. For example, version 1.31.1 would be
801tagged as &quot;-1_31_1&quot;.</dd>
802<dt><tt class="docutils literal">.lib</tt></dt>
803<dd><em>Extension</em>: determined according to the operating system's usual
804convention.  On most unix-style platforms the extensions are
805<tt class="docutils literal">.a</tt> and <tt class="docutils literal">.so</tt> for static libraries (archives) and shared
806libraries, respectively.  On Windows, <tt class="docutils literal">.dll</tt> indicates a shared
807library and <tt class="docutils literal">.lib</tt> indicates a
808static or import library.  Where supported by toolsets on unix
809variants, a full version extension is added (e.g. &quot;.so.1.34&quot;) and
810a symbolic link to the library file, named without the trailing
811version number, will also be created.</dd>
812</dl>
813<!-- .. _Boost.Build toolset names: toolset-name_ -->
814<!-- Copyright David Abrahams 2006. Distributed under the Boost -->
815<!-- Software License, Version 1.0. (See accompanying -->
816<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
817</div>
818<div class="section" id="test-your-program">
819<h2><a class="toc-backref" href="#id48">6.4&nbsp;&nbsp;&nbsp;Test Your Program</a></h2>
820<p>To test our subject extraction, we'll filter the following text
821file.  Copy it out of your browser and save it as <tt class="docutils literal">jayne.txt</tt>:</p>
822<pre class="literal-block">
823To: George Shmidlap
824From: Rita Marlowe
825Subject: Will Success Spoil Rock Hunter?
826---
827See subject.
828</pre>
829<p>Now, in a <a class="reference internal" href="#command-prompt">command prompt</a> window, type:</p>
830<pre class="literal-block">
831<em>path</em>\<em>to</em>\<em>compiled</em>\example &lt; <em>path</em>\<em>to</em>\jayne.txt
832</pre>
833<p>The program should respond with the email subject, “Will Success
834Spoil Rock Hunter?”</p>
835<!-- Copyright David Abrahams 2006. Distributed under the Boost -->
836<!-- Software License, Version 1.0. (See accompanying -->
837<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
838</div>
839</div>
840<div class="section" id="conclusion-and-further-resources">
841<h1><a class="toc-backref" href="#id49">7&nbsp;&nbsp;&nbsp;Conclusion and Further Resources</a></h1>
842<p>This concludes your introduction to Boost and to integrating it
843with your programs.  As you start using Boost in earnest, there are
844surely a few additional points you'll wish we had covered.  One day
845we may have a “Book 2 in the Getting Started series” that addresses
846them.  Until then, we suggest you pursue the following resources.
847If you can't find what you need, or there's anything we can do to
848make this document clearer, please post it to the <a class="reference external" href="http://www.boost.org/more/mailing_lists.htm#users">Boost Users'
849mailing list</a>.</p>
850<ul class="simple">
851<li><a class="reference external" href="../../tools/build/index.html">Boost.Build reference manual</a></li>
852<li><a class="reference external" href="http://www.boost.org/more/mailing_lists.htm#users">Boost Users' mailing list</a></li>
853<li><a class="reference external" href="http://www.boost.org/more/mailing_lists.htm#jamboost">Boost.Build mailing list</a></li>
854<li><a class="reference external" href="../../libs/index.html">Index of all Boost library documentation</a></li>
855</ul>
856<div class="admonition-onward admonition">
857<p class="first admonition-title">Onward</p>
858<blockquote class="epigraph last">
859<p>Good luck, and have fun!</p>
860<p class="attribution">&mdash;the Boost Developers</p>
861</blockquote>
862</div>
863<hr class="docutils" />
864<table class="docutils footnote" frame="void" id="zip" rules="none">
865<colgroup><col class="label" /><col /></colgroup>
866<tbody valign="top">
867<tr><td class="label"><a class="fn-backref" href="#id2">[1]</a></td><td>We recommend
868downloading <a class="reference external" href="http://www.boost.org/users/history/version_1_73_0.html"><tt class="docutils literal">boost_1_73_0</tt><tt class="docutils literal">.7z</tt></a> and using <a class="reference external" href="http://www.7-zip.org">7-Zip</a> to decompress
869it.  We no longer recommend .zip files for Boost because they are twice
870as large as the equivalent .7z files.  We don't recommend using Windows'
871built-in decompression as it can be painfully slow for large archives.</td></tr>
872</tbody>
873</table>
874<table class="docutils footnote" frame="void" id="pch" rules="none">
875<colgroup><col class="label" /><col /></colgroup>
876<tbody valign="top">
877<tr><td class="label"><a class="fn-backref" href="#id6">[2]</a></td><td>There's no problem using Boost with precompiled headers;
878these instructions merely avoid precompiled headers because it
879would require Visual Studio-specific changes to the source code
880used in the examples.</td></tr>
881</tbody>
882</table>
883<table class="docutils footnote" frame="void" id="continuation" rules="none">
884<colgroup><col class="label" /><col /></colgroup>
885<tbody valign="top">
886<tr><td class="label"><a class="fn-backref" href="#id15">[3]</a></td><td><p class="first">In this example, the caret character <tt class="docutils literal">^</tt> is a
887way of continuing the command on multiple lines, and must be the
888<strong>final character</strong> used on the line to be continued (i.e. do
889not follow it with spaces).  The command prompt responds with
890<tt class="docutils literal">More?</tt> to prompt for more input.  Feel free to omit the
891carets and subsequent newlines; we used them so the example
892would fit on a page of reasonable width.</p>
893<p>The command prompt treats each bit of whitespace in the command
894as an argument separator.  That means quotation marks (<tt class="docutils literal">&quot;</tt>)
895are required to keep text together whenever a single
896command-line argument contains spaces, as in</p>
897<pre class="literal-block">
898--build-dir=<span class="raw-html"><strong style="background-color:#B4FFB4">"</strong></span>C:\Documents<span class="raw-html"><strong style="color:#B4B4B4; background-color:#B4FFB4">_</strong></span>and<span class="raw-html"><strong style="color:#B4B4B4; background-color:#B4FFB4">_</strong></span>Settings\dave\build-boost<span class="raw-html"><strong style="background-color:#B4FFB4">"</strong></span>
899</pre>
900<p>Also, for example, you can't add spaces around the <tt class="docutils literal">=</tt> sign as in</p>
901<pre class="last literal-block">
902--build-dir<span class="raw-html"><strong style="color:#B4B4B4; background-color:#FFB4B4">_</strong></span>=<span class="raw-html"><strong style="color:#B4B4B4; background-color:#FFB4B4">_</strong></span>&quot;C:\Documents and Settings\dave\build-boost&quot;
903</pre>
904</td></tr>
905</tbody>
906</table>
907<!-- Copyright David Abrahams 2006. Distributed under the Boost -->
908<!-- Software License, Version 1.0. (See accompanying -->
909<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
910<table class="docutils footnote" frame="void" id="warnings" rules="none">
911<colgroup><col class="label" /><col /></colgroup>
912<tbody valign="top">
913<tr><td class="label"><a class="fn-backref" href="#id8">[4]</a></td><td>Remember that warnings are specific to each compiler
914implementation.  The developer of a given Boost library might
915not have access to your compiler.  Also, some warnings are
916extremely difficult to eliminate in generic code, to the point
917where it's not worth the trouble.  Finally, some compilers don't
918have any source code mechanism for suppressing warnings.</td></tr>
919</tbody>
920</table>
921<table class="docutils footnote" frame="void" id="distinct" rules="none">
922<colgroup><col class="label" /><col /></colgroup>
923<tbody valign="top">
924<tr><td class="label"><a class="fn-backref" href="#id23">[5]</a></td><td>This convention distinguishes the static version of
925a Boost library from the import library for an
926identically-configured Boost DLL, which would otherwise have the
927same name.</td></tr>
928</tbody>
929</table>
930<table class="docutils footnote" frame="void" id="debug-abi" rules="none">
931<colgroup><col class="label" /><col /></colgroup>
932<tbody valign="top">
933<tr><td class="label"><a class="fn-backref" href="#id24">[6]</a></td><td>These libraries were compiled without optimization
934or inlining, with full debug symbols enabled, and without
935<tt class="docutils literal">NDEBUG</tt> <tt class="docutils literal">#define</tt>d.  Although it's true that sometimes
936these choices don't affect binary compatibility with other
937compiled code, you can't count on that with Boost libraries.</td></tr>
938</tbody>
939</table>
940<!-- Copyright David Abrahams 2006. Distributed under the Boost -->
941<!-- Software License, Version 1.0. (See accompanying -->
942<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
943<!-- This file contains all the definitions that need to be updated -->
944<!-- for each new release of Boost. -->
945<!-- Copyright David Abrahams 2006. Distributed under the Boost -->
946<!-- Software License, Version 1.0. (See accompanying -->
947<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
948<!-- Copyright David Abrahams 2006. Distributed under the Boost -->
949<!-- Software License, Version 1.0. (See accompanying -->
950<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
951<!-- Copyright David Abrahams 2006. Distributed under the Boost -->
952<!-- Software License, Version 1.0. (See accompanying -->
953<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
954</div>
955</div>
956</body>
957</html>
958