| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843 |
- <?xml version="1.0" encoding="utf-8" ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <meta name="generator" content="Docutils 0.5: http://docutils.sourceforge.net/" />
- <title>Getting Started With Boost Boost</title>
- <link rel="stylesheet" href="../rst.css" type="text/css" />
- </head>
- <body>
- <div class="document" id="getting-started-with-boost-logo">
- <h1 class="title">Getting Started With Boost <a class="reference" href="../index.htm"><img alt="Boost" src="../boost.png" /></a></h1>
- <p>This guide will help you get started using the Boost libraries.
- Have fun!</p>
- <div class="contents topic">
- <p class="topic-title first"><a id="index" name="index">Index</a></p>
- <ul class="auto-toc simple">
- <li><a class="reference" href="#getting-boost" id="id20" name="id20">1 Getting Boost</a></li>
- <li><a class="reference" href="#the-structure-of-a-boost-distribution" id="id21" name="id21">2 The Structure of a Boost Distribution</a></li>
- <li><a class="reference" href="#building-a-simple-boost-program" id="id22" name="id22">3 Building a Simple Boost Program</a><ul class="auto-toc">
- <li><a class="reference" href="#nix-e-g-unix-linux-macos-cygwin" id="id23" name="id23">3.1 *nix (e.g. Unix, Linux, MacOS, Cygwin)</a></li>
- <li><a class="reference" href="#microsoft-windows-command-line-using-visual-c" id="id24" name="id24">3.2 Microsoft Windows Command-Line using Visual C++</a></li>
- <li><a class="reference" href="#visual-studio-net-2003-or-visual-studio-2005" id="id25" name="id25">3.3 Visual Studio .NET 2003 or Visual Studio 2005</a></li>
- <li><a class="reference" href="#other-compilers-environments" id="id26" name="id26">3.4 Other Compilers/Environments</a></li>
- </ul>
- </li>
- <li><a class="reference" href="#getting-boost-library-binaries" id="id27" name="id27">4 Getting Boost Library Binaries</a><ul class="auto-toc">
- <li><a class="reference" href="#microsoft-visual-c-8-0-or-7-1-visual-studio-2005-net-2003-binaries" id="id28" name="id28">4.1 Microsoft Visual C++ 8.0 or 7.1 (Visual Studio 2005/.NET 2003) Binaries</a></li>
- <li><a class="reference" href="#nix-e-g-unix-linux-macos-cygwin-binaries" id="id29" name="id29">4.2 *nix (e.g. Unix, Linux, MacOS, Cygwin) Binaries</a></li>
- <li><a class="reference" href="#id7" id="id30" name="id30">4.3 Other Compilers/Environments</a></li>
- <li><a class="reference" href="#building-boost-binaries-with-boost-build" id="id31" name="id31">4.4 Building Boost Binaries with Boost.Build</a><ul class="auto-toc">
- <li><a class="reference" href="#getting-bjam" id="id32" name="id32">4.4.1 Getting <tt class="docutils literal"><span class="pre">bjam</span></tt></a></li>
- <li><a class="reference" href="#identify-your-toolset" id="id33" name="id33">4.4.2 Identify Your Toolset</a></li>
- <li><a class="reference" href="#select-a-build-directory" id="id34" name="id34">4.4.3 Select a Build Directory</a></li>
- <li><a class="reference" href="#invoke-bjam" id="id35" name="id35">4.4.4 Invoke <tt class="docutils literal"><span class="pre">bjam</span></tt></a></li>
- <li><a class="reference" href="#stage" id="id36" name="id36">4.4.5 <tt class="docutils literal"><span class="pre">stage</span></tt></a></li>
- <li><a class="reference" href="#select-a-prefix-directory" id="id37" name="id37">4.4.6 Select a Prefix Directory</a></li>
- </ul>
- </li>
- </ul>
- </li>
- <li><a class="reference" href="#linking-a-program-with-a-boost-library" id="id38" name="id38">5 Linking A Program with a Boost Library</a><ul class="auto-toc">
- <li><a class="reference" href="#microsoft-windows" id="id39" name="id39">5.1 Microsoft Windows</a><ul class="auto-toc">
- <li><a class="reference" href="#visual-c-command-line" id="id40" name="id40">5.1.1 Visual C++ Command Line</a></li>
- <li><a class="reference" href="#visual-studio-ide" id="id41" name="id41">5.1.2 Visual Studio IDE</a></li>
- </ul>
- </li>
- <li><a class="reference" href="#id13" id="id42" name="id42">5.2 *nix (e.g. Unix, Linux, MacOS, Cygwin)</a></li>
- <li><a class="reference" href="#library-naming" id="id43" name="id43">5.3 Library Naming</a></li>
- </ul>
- </li>
- </ul>
- </div>
- <!-- ## Update this substitution for each release -->
- <div class="section">
- <h1><a class="toc-backref" href="#id20" id="getting-boost" name="getting-boost">1 Getting Boost</a></h1>
- <p>There are basically three ways to get Boost on your system:</p>
- <ol class="arabic simple">
- <li>Download and run the <a class="reference" href="http://www.boost-consulting.com/download.html">Windows installer</a> supplied by Boost
- Consulting (not available for Boost alpha/beta releases).</li>
- </ol>
- <!-- ## remove the parenthesized note for full releases -->
- <ol class="arabic simple" start="2">
- <li>or, <a class="reference" href="http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=8041&release_id=376197">download a complete Boost distribution</a> from SourceForge.</li>
- </ol>
- <!-- ## Update this link for each release -->
- <blockquote>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Windows users:</th><td class="field-body"><p class="first"><tt class="docutils literal"><span class="pre">boost_1_34_0</span></tt><tt class="docutils literal"><span class="pre">.exe</span></tt> is a program you can
- run to unpack the distribution; if you prefer not to download
- executable programs, get <tt class="docutils literal"><span class="pre">boost_1_34_0</span></tt><tt class="docutils literal"><span class="pre">.zip</span></tt> 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.</p>
- </td>
- </tr>
- <tr class="field"><th class="field-name">*nix users:</th><td class="field-body"><p class="first">Download <tt class="docutils literal"><span class="pre">boost_1_34_0</span></tt><tt class="docutils literal"><span class="pre">.tar.bz2</span></tt>, then, in the
- directory where you want to put the Boost installation,
- execute</p>
- <pre class="last literal-block">
- tar --bzip2 -xf <em>/path/to/</em><tt class="docutils literal"><span class="pre">boost_1_34_0</span></tt>.tar.bz2
- </pre>
- </td>
- </tr>
- </tbody>
- </table>
- </blockquote>
- <ol class="arabic simple" start="3">
- <li>or use a Boost package from RedHat, Debian, or some other
- distribution packager. These instructions may not work for you
- if you use this method, because other packagers sometimes choose
- to break Boost up into several packages or to reorganize the
- directory structure of the Boost distribution.<a class="footnote-reference" href="#packagers" id="id3" name="id3"><sup>1</sup></a></li>
- </ol>
- </div>
- <div class="section">
- <h1><a class="toc-backref" href="#id21" id="the-structure-of-a-boost-distribution" name="the-structure-of-a-boost-distribution">2 The Structure of a Boost Distribution</a></h1>
- <p>This is is a sketch of the directory structure you'll get when you
- unpack your Boost installation (windows users replace forward
- slashes with backslashes):</p>
- <pre class="literal-block">
- <strong>boost_1_34_0/</strong> .................<em>The “boost root directory”</em>
- <strong>index.html</strong> ....................<em>A copy of www.boost.org</em>
- <strong>boost/</strong> .........................<em>All Boost Header files</em>
- <strong>libs/</strong> ............<em>Tests, .cpp</em>s<em>, docs, etc., by library</em><a class="footnote-reference" href="#installer-src" id="id4" name="id4"><sup>2</sup></a>
- <strong>index.html</strong> ........<em>Library documentation starts here</em>
- <strong>algorithm/</strong>
- <strong>any/</strong>
- <strong>array/</strong>
- <em>…more libraries…</em>
- <strong>status/</strong> .........................<em>Boost-wide test suite</em>
- <strong>tools/</strong> ...........<em>Utilities, e.g. bjam, quickbook, bcp</em>
- <strong>more/</strong> ..........................<em>Policy documents, etc.</em>
- <strong>doc/</strong> ...............<em>A subset of all Boost library docs</em>
- </pre>
- <div class="sidebar">
- <p class="first sidebar-title">Header Organization</p>
- <p>The organization of Boost library headers isn't entirely uniform,
- but most libraries follow a few patterns:</p>
- <ul class="last simple">
- <li>Some older libraries and most very small libraries place all
- public headers directly into <tt class="docutils literal"><span class="pre">boost/</span></tt>.</li>
- <li>Most libraries' public headers live in a subdirectory of
- <tt class="docutils literal"><span class="pre">boost/</span></tt> named after the library. For example, you'll find
- the Type Traits Library's <tt class="docutils literal"><span class="pre">is_void.hpp</span></tt> header in
- <tt class="docutils literal"><span class="pre">boost/type_traits/is_void.hpp</span></tt>.</li>
- <li>Some libraries have an “aggregate header” in <tt class="docutils literal"><span class="pre">boost/</span></tt> that
- <tt class="docutils literal"><span class="pre">#include</span></tt>s all of the library's other headers. For
- example, Boost.Python's aggregate header is
- <tt class="docutils literal"><span class="pre">boost/python.hpp</span></tt>.</li>
- <li>Most libraries place private headers in a subdirectory called
- <tt class="docutils literal"><span class="pre">detail/</span></tt> or <tt class="docutils literal"><span class="pre">aux_/</span></tt>. Don't look in these directories and
- expect to find anything you can use.</li>
- </ul>
- </div>
- <p>A few things are worth noting right off the bat:</p>
- <ol class="arabic">
- <li><p class="first">The path to the “boost root directory” is sometimes referred to
- as <tt class="docutils literal"><span class="pre">$BOOST_ROOT</span></tt> in documentation and mailing lists. If you
- used the Windows installer, that will usually be <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_34_0</span></tt>.</p>
- </li>
- <li><p class="first">To compile anything in Boost, you need a directory containing
- the <tt class="docutils literal"><span class="pre">boost/</span></tt> subdirectory in your <tt class="docutils literal"><span class="pre">#include</span></tt> path. For most
- compilers, that means adding</p>
- <pre class="literal-block">
- -I<tt class="docutils literal"><span class="pre">/</span></tt><em>path</em><tt class="docutils literal"><span class="pre">/</span></tt><em>to</em><tt class="docutils literal"><span class="pre">/</span></tt><tt class="docutils literal"><span class="pre">boost_1_34_0</span></tt>
- </pre>
- <p>to the command line. Specific steps for setting up <tt class="docutils literal"><span class="pre">#include</span></tt>
- paths in Microsoft Visual Studio follow later in this document;
- if you use another IDE, please consult your product's
- documentation for instructions.</p>
- </li>
- <li><p class="first">Since all of Boost's header files have the <tt class="docutils literal"><span class="pre">.hpp</span></tt> extension,
- and live in the <tt class="docutils literal"><span class="pre">boost/</span></tt> subdirectory of the boost root, your
- Boost <tt class="docutils literal"><span class="pre">#include</span></tt> directives will look like:</p>
- <pre class="literal-block">
- #include <boost/<em>whatever</em>.hpp>
- </pre>
- <p>or</p>
- <pre class="literal-block">
- #include "boost/<em>whatever</em>.hpp"
- </pre>
- </li>
- </ol>
- <blockquote>
- depending on your religion as regards the use of angle bracket
- includes. Even Windows users can use forward slashes in
- <tt class="docutils literal"><span class="pre">#include</span></tt> directives; your compiler doesn't care.</blockquote>
- <ol class="arabic simple" start="4">
- <li>Don't be distracted by the <tt class="docutils literal"><span class="pre">doc/</span></tt> subdirectory; it only
- contains a subset of the Boost documentation. Start with
- <tt class="docutils literal"><span class="pre">libs/index.html</span></tt> if you're looking for the whole enchilada.</li>
- </ol>
- </div>
- <div class="section">
- <h1><a class="toc-backref" href="#id22" id="building-a-simple-boost-program" name="building-a-simple-boost-program">3 Building a Simple Boost Program</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-header-only-libraries admonition">
- <p class="first admonition-title">Header-Only Libraries</p>
- <p>Nearly all Boost libraries are <strong>header-only</strong>. That is, most
- consist entirely of header files containing templates and inline
- functions, and require no separately-compiled library binaries
- or special treatment when linking.</p>
- <p>The only Boost libraries that are <em>not</em> header-only are:</p>
- <ul class="simple">
- <li>Boost.Filesystem</li>
- <li>Boost.IOStreams</li>
- <li>Boost.ProgramOptions</li>
- <li>Boost.Python</li>
- <li>Boost.Regex</li>
- <li>Boost.Serialization</li>
- <li>Boost.Signals</li>
- <li>Boost.Test</li>
- <li>Boost.Thread</li>
- <li>Boost.Wave</li>
- </ul>
- <p class="last">The DateTime library has a separately-compiled
- binary which is only needed if you're using a “legacy
- compiler”(such as?). The Graph library has a
- separately-compiled binary, but you won't need it unless you
- intend to <a class="reference" href="../libs/graph/doc/read_graphviz.html">parse GraphViz files</a>.</p>
- </div>
- <!-- ## Keep the list of non-header-only libraries up-to-date -->
- <p>The following program reads a sequence of integers from standard
- input, uses Boost.Lambda (a header-only library) to multiply each
- one by three, and writes them to standard output:</p>
- <pre class="literal-block">
- #include <boost/lambda/lambda.hpp>
- #include <iostream>
- #include <iterator>
- #include <algorithm>
- int main()
- {
- using namespace boost::lambda;
- typedef std::istream_iterator<int> in;
- std::for_each(
- in(std::cin), in(), std::cout << (_1 * 3) << " " );
- }
- </pre>
- <p>Start by copying the text of this program into a file called
- <tt class="docutils literal"><span class="pre">example.cpp</span></tt>.</p>
- <div class="section">
- <h2><a class="toc-backref" href="#id23" id="nix-e-g-unix-linux-macos-cygwin" name="nix-e-g-unix-linux-macos-cygwin"><span id="unix-header-only"></span>3.1 *nix (e.g. Unix, Linux, MacOS, Cygwin)</a></h2>
- <p>Simply issue the following command (<tt class="docutils literal"><span class="pre">$</span></tt> represents the
- prompt issued by the shell, so don't type that):</p>
- <pre class="literal-block">
- <strong>$</strong> c++ -I <tt class="docutils literal"><span class="pre">/</span></tt><em>path</em><tt class="docutils literal"><span class="pre">/</span></tt><em>to</em><tt class="docutils literal"><span class="pre">/</span></tt><tt class="docutils literal"><span class="pre">boost_1_34_0</span></tt> example.cpp -o example
- </pre>
- <p>To test the result, type:</p>
- <pre class="literal-block">
- <strong>$</strong> echo 1 2 3 | ./example
- </pre>
- </div>
- <div class="section">
- <h2><a class="toc-backref" href="#id24" id="microsoft-windows-command-line-using-visual-c" name="microsoft-windows-command-line-using-visual-c">3.2 Microsoft Windows Command-Line using Visual C++</a></h2>
- <p>From your computer's <em>Start</em> menu, select if you are a Visual
- Studio 2005 user, select</p>
- <blockquote>
- <em>All Programs</em> > <em>Microsoft Visual Studio 2005</em>
- > <em>Visual Studio Tools</em> > <em>Visual Studio 2005 Command Prompt</em></blockquote>
- <p>or if you're a Visual Studio .NET 2003 user, select</p>
- <blockquote>
- <em>All Programs</em> > <em>Microsoft Visual Studio .NET 2003</em>
- > <em>Visual Studio .NET Tools</em> > <em>Visual Studio .NET 2003 Command Prompt</em></blockquote>
- <p>to bring up a special command prompt window set up for the Visual
- Studio compiler. In that window, type the following command and
- hit the return key (<tt class="docutils literal"><span class="pre">C:\PROMPT></span></tt> represents the prompt issued by
- the shell, so don't type that):</p>
- <pre class="literal-block">
- <strong>C:PROMPT></strong> cl /EHsc /I <em>C:</em><tt class="docutils literal"><span class="pre">\</span></tt><em>path</em><tt class="docutils literal"><span class="pre">\</span></tt><em>to</em><tt class="docutils literal"><span class="pre">\</span></tt><tt class="docutils literal"><span class="pre">boost_1_34_0</span></tt> example.cpp
- </pre>
- <p>To test the result, type:</p>
- <pre class="literal-block">
- <strong>C:PROMPT></strong> echo 1 2 3 | example
- </pre>
- </div>
- <div class="section">
- <h2><a class="toc-backref" href="#id25" id="visual-studio-net-2003-or-visual-studio-2005" name="visual-studio-net-2003-or-visual-studio-2005"><span id="vs-header-only"></span>3.3 Visual Studio .NET 2003 or Visual Studio 2005</a></h2>
- <ul class="simple">
- <li>From Visual Studio's <em>File</em> menu, select <em>New</em> > <em>Project…</em></li>
- <li>In the left-hand pane of the resulting <em>New Project</em> dialog,
- select <em>Visual C++</em> > <em>Win32</em>.</li>
- <li>In the right-hand pane, select <em>Win32 Console Application</em>
- (VS8.0) or <em>Win32 Console Project</em> (VS7.1).</li>
- <li>In the <em>name</em> field, enter “example”</li>
- <li>Right-click <strong>example</strong> in the <em>Solution Explorer</em> pane and
- select <em>Properties</em> from the resulting pop-up menu</li>
- <li>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, 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_34_0</span></tt>.</li>
- <li>In <em>Configuration Properties</em> > <em>C/C++</em> > <em>Precompiled Headers</em>, change
- <em>Use Precompiled Header (/Yu)</em> to <em>Not Using Precompiled
- Headers</em>.<a class="footnote-reference" href="#pch" id="id6" name="id6"><sup>3</sup></a></li>
- <li>Replace the contents of the <tt class="docutils literal"><span class="pre">example.cpp</span></tt> generated by the IDE
- with the example code above.</li>
- <li>From the <em>Build</em> menu, select <em>Build Solution</em>.</li>
- </ul>
- <p>To test your application, hit the F5 key and type the following
- into the resulting window, followed by the return key:</p>
- <pre class="literal-block">
- 1 2 3
- </pre>
- <p>Then hold down the control key and press "Z", followed by the
- return key.</p>
- </div>
- <div class="section">
- <h2><a class="toc-backref" href="#id26" id="other-compilers-environments" name="other-compilers-environments">3.4 Other Compilers/Environments</a></h2>
- <p>Consult your vendor's documentation; if you have trouble adapting
- these instructions to your build environment, request assistance on
- the <a class="reference" href="mailing_lists.htm#users">Boost Users' mailing list</a>.</p>
- </div>
- </div>
- <div class="section">
- <h1><a class="toc-backref" href="#id27" id="getting-boost-library-binaries" name="getting-boost-library-binaries">4 Getting Boost Library Binaries</a></h1>
- <p>If you want to use any of the separately-compiled Boost libraries,
- you'll need to get ahold of library binaries.</p>
- <div class="section">
- <h2><a class="toc-backref" href="#id28" id="microsoft-visual-c-8-0-or-7-1-visual-studio-2005-net-2003-binaries" name="microsoft-visual-c-8-0-or-7-1-visual-studio-2005-net-2003-binaries">4.1 Microsoft Visual C++ 8.0 or 7.1 (Visual Studio 2005/.NET 2003) Binaries</a></h2>
- <p>The <a class="reference" href="http://www.boost-consulting.com/download.html">Windows installer</a> supplied by Boost Consulting 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_34_0</span></tt><tt class="docutils literal"><span class="pre">\lib\</span></tt>.</p>
- </div>
- <div class="section">
- <h2><a class="toc-backref" href="#id29" id="nix-e-g-unix-linux-macos-cygwin-binaries" name="nix-e-g-unix-linux-macos-cygwin-binaries">4.2 *nix (e.g. Unix, Linux, MacOS, Cygwin) Binaries</a></h2>
- <p>Issue the following commands in the shell (again, <tt class="docutils literal"><span class="pre">$</span></tt> represents
- the shell's prompt):</p>
- <pre class="literal-block">
- <strong>$</strong> cd <tt class="docutils literal"><span class="pre">/</span></tt><em>path</em><tt class="docutils literal"><span class="pre">/</span></tt><em>to</em><tt class="docutils literal"><span class="pre">/</span></tt><tt class="docutils literal"><span class="pre">boost_1_34_0</span></tt>
- <strong>$</strong> ./configure --help
- </pre>
- <p>Select your configuration options and invoke <tt class="docutils literal"><span class="pre">./configure</span></tt> again.
- Unless you have write permission in your system's <tt class="docutils literal"><span class="pre">/usr/local/</span></tt>
- directory, you'll probably want to at least use</p>
- <pre class="literal-block">
- <strong>$</strong> ./configure <strong>--prefix=</strong><em>path</em>/<em>to</em>/<em>installation</em>/<em>prefix</em>
- </pre>
- <p>to install somewhere else. Finally,</p>
- <pre class="literal-block">
- <strong>$</strong> make install
- </pre>
- <p>which will leave Boost binaries in the <tt class="docutils literal"><span class="pre">lib/</span></tt> subdirectory of
- your installation prefix. You will also find a copy of the Boost
- headers in the <tt class="docutils literal"><span class="pre">include/</span></tt> subdirectory of the installation
- prefix, so you can henceforth use that directory as an <tt class="docutils literal"><span class="pre">#include</span></tt>
- path in place of the Boost root directory.</p>
- </div>
- <div class="section">
- <h2><a class="toc-backref" href="#id30" id="id7" name="id7">4.3 Other Compilers/Environments</a></h2>
- <p>If you're not using Visual C++ 7.1 or 8.0, or you're a *nix user
- who wants want to build with a toolset other than your system's
- default, or if you want a nonstandard variant build of Boost
- (e.g. optimized, but with debug symbols), you'll need to use
- <a class="reference" href="../tools/build/index.html">Boost.Build</a> to create your own binaries.</p>
- </div>
- <div class="section">
- <h2><a id="building-boost-binaries-with-boost-build" name="building-boost-binaries-with-boost-build">4.4 Building Boost Binaries with <a class="reference" href="../tools/build/index.html">Boost.Build</a></a></h2>
- <p>Like an IDE, <a class="reference" href="../tools/build/index.html">Boost.Build</a> is a system for developing, testing, and
- installing software. Instead of using a GUI, though, <a class="reference" href="../tools/build/index.html">Boost.Build</a>
- is text-based, like <tt class="docutils literal"><span class="pre">make</span></tt>. <a class="reference" href="../tools/build/index.html">Boost.Build</a> is written in the
- interpreted <a class="reference" href="../tools/jam/index.html">Boost.Jam</a> language.</p>
- <p>To use <a class="reference" href="../tools/build/index.html">Boost.Build</a>, you'll need an executable called <tt class="docutils literal"><span class="pre">bjam</span></tt>, the
- <a class="reference" href="../tools/jam/index.html">Boost.Jam</a> interpreter.</p>
- <!-- nosidebar .. sidebar:: Using Boost.Build for your own project
- When you use Boost.Build to build your *own* project, you don't
- need a separate step to create Boost binaries: you simply refer
- to the boost library targets from your Jamfile and the are built
- automatically (refer to the `Boost.Build documentation`_ for
- detailed instructions). Here, we're assuming you're using a
- different build system for your own code, so you need to
- explicitly generate Boost binaries. We're also assuming that
- you have a complete Boost distribution somewhere. -->
- <div class="section">
- <h3><a class="toc-backref" href="#id32" id="getting-bjam" name="getting-bjam">4.4.1 Getting <tt class="docutils literal"><span class="pre">bjam</span></tt></a></h3>
- <div class="sidebar">
- <p class="first sidebar-title">Using command-line tools in Windows</p>
- <p>In Windows, a command-line tool is invoked by typing its name,
- optionally followed by arguments, into a <em>Command Prompt</em> window
- and pressing the Return (or Enter) key.</p>
- <p>To open <em>Command Prompt</em>, click the <em>Start</em> menu button, click
- <em>Run</em>, type “cmd”, and then click OK.</p>
- <p>All commands are executed within the context of a <strong>current
- directory</strong> in the filesystem. To set the current directory,
- type:</p>
- <pre class="literal-block">
- 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_34_0</span></tt>
- </pre>
- <p>One way to name a directory you know about is to write</p>
- <pre class="literal-block">
- %HOMEDRIVE%%HOMEPATH%\<em>directory-name</em>
- </pre>
- <p>which indicates a sibling folder of your “My Documents” folder.</p>
- <p class="last">Long commands can be continued across several lines by typing
- backslashes at the ends of all but the last line. Many of the
- examples on this page use that technique to save horizontal
- space.</p>
- </div>
- <p>Boost provides <a class="reference" href="http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=72941">pre-compiled <tt class="docutils literal"><span class="pre">bjam</span></tt> executables</a> for a variety of platforms.
- Alternatively, you can build <tt class="docutils literal"><span class="pre">bjam</span></tt> yourself using the
- <a class="reference" href="http://www.boost.org/doc/html/jam/building.html">instructions</a> given in the <a class="reference" href="../tools/jam/index.html">Boost.Jam documentation</a>.</p>
- <p><tt class="docutils literal"><span class="pre">bjam</span></tt> is a command-line tool. To build Boost binaries, you'll
- invoke <tt class="docutils literal"><span class="pre">bjam</span></tt> with the current directory set to the Boost root,
- and with options described in the following sections.</p>
- </div>
- <div class="section">
- <h3><a class="toc-backref" href="#id33" id="identify-your-toolset" name="identify-your-toolset"><span id="toolset-name"></span><span id="toolset"></span>4.4.2 Identify Your Toolset</a></h3>
- <p>First, find the toolset corresponding to your compiler in the
- following table.</p>
- <table border="1" class="docutils">
- <colgroup>
- <col width="18%" />
- <col width="33%" />
- <col width="48%" />
- </colgroup>
- <thead valign="bottom">
- <tr><th class="head">Toolset
- Name</th>
- <th class="head">Vendor</th>
- <th class="head">Notes</th>
- </tr>
- </thead>
- <tbody valign="top">
- <tr><td><tt class="docutils literal"><span class="pre">acc</span></tt></td>
- <td>Hewlett Packard</td>
- <td>Only very recent versions are
- known to work well with Boost</td>
- </tr>
- <tr><td><tt class="docutils literal"><span class="pre">borland</span></tt></td>
- <td>Borland</td>
- <td> </td>
- </tr>
- <tr><td><tt class="docutils literal"><span class="pre">como</span></tt></td>
- <td>Comeau Computing</td>
- <td>Using this toolset may
- require <a class="reference" href="../tools/build/index.html">configuring</a> another
- toolset to act as its backend</td>
- </tr>
- <tr><td><tt class="docutils literal"><span class="pre">cw</span></tt></td>
- <td>Metrowerks/FreeScale</td>
- <td>The CodeWarrior compiler. We
- have not tested versions of
- this compiler produced since
- it was sold to FreeScale.</td>
- </tr>
- <tr><td><tt class="docutils literal"><span class="pre">dmc</span></tt></td>
- <td>Digital Mars</td>
- <td>As of this Boost release, no
- version of dmc is known to
- handle Boost well.</td>
- </tr>
- <tr><td><tt class="docutils literal"><span class="pre">gcc</span></tt></td>
- <td>The Gnu Project</td>
- <td> </td>
- </tr>
- <tr><td><tt class="docutils literal"><span class="pre">hp_cxx</span></tt></td>
- <td>Hewlett Packard</td>
- <td>Targeted at the Tru64
- operating system.</td>
- </tr>
- <tr><td><tt class="docutils literal"><span class="pre">intel</span></tt></td>
- <td>Intel</td>
- <td> </td>
- </tr>
- <tr><td><tt class="docutils literal"><span class="pre">kylix</span></tt></td>
- <td>Borland</td>
- <td> </td>
- </tr>
- <tr><td><tt class="docutils literal"><span class="pre">msvc</span></tt></td>
- <td>Microsoft</td>
- <td> </td>
- </tr>
- <tr><td><tt class="docutils literal"><span class="pre">qcc</span></tt></td>
- <td>QNX Software Systems</td>
- <td> </td>
- </tr>
- <tr><td><tt class="docutils literal"><span class="pre">sun</span></tt></td>
- <td>Sun</td>
- <td> </td>
- </tr>
- <tr><td><tt class="docutils literal"><span class="pre">vacpp</span></tt></td>
- <td>IBM</td>
- <td>The VisualAge C++ compiler.</td>
- </tr>
- </tbody>
- </table>
- <p>If you have multiple versions of a particular compiler installed,
- you can apend the version number to the toolset name, preceded by a
- hyphen, e.g. <tt class="docutils literal"><span class="pre">msvc-7.1</span></tt> or <tt class="docutils literal"><span class="pre">gcc-3.4</span></tt>.</p>
- <div class="note">
- <p class="first admonition-title">Note</p>
- <p class="last">if you built <tt class="docutils literal"><span class="pre">bjam</span></tt> yourself, you may
- have selected a toolset name for that purpose, but that does not
- affect this step in any way; you still need to select a Boost.Build
- toolset from the table.</p>
- </div>
- </div>
- <div class="section">
- <h3><a class="toc-backref" href="#id34" id="select-a-build-directory" name="select-a-build-directory"><span id="id10"></span><span id="build-directory"></span>4.4.3 Select a Build Directory</a></h3>
- <p><a class="reference" 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
- default Boost.Build will create a <tt class="docutils literal"><span class="pre">bin.v2/</span></tt> subdirectory for that
- purpose in your current working directory.</p>
- </div>
- <div class="section">
- <h3><a class="toc-backref" href="#id35" id="invoke-bjam" name="invoke-bjam">4.4.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 --build-dir=<a class="reference" href="#id10"><em>build-directory</em></a> <strong>\</strong>
- --toolset=<a class="reference" href="#toolset-name"><em>toolset-name</em></a> stage
- </pre>
- <p>For example, on Windows, your session might look like:</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_34_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_34_0</span></tt>> bjam <strong>\</strong>
- <strong>--build-dir=</strong>%HOMEDRIVE%%HOMEPATH%\build-boost <strong>\</strong>
- <strong>--toolset=msvc stage</strong>
- </pre>
- <div class="note">
- <p class="first admonition-title">Note</p>
- <p class="last"><tt class="docutils literal"><span class="pre">bjam</span></tt> is case-sensitive; it is important that all the
- parts shown in <strong>bold</strong> type above be entirely lower-case.</p>
- </div>
- <p>And on Unix:</p>
- <pre class="literal-block">
- ~$ cd ~/<tt class="docutils literal"><span class="pre">boost_1_34_0</span></tt>
- ~/<tt class="docutils literal"><span class="pre">boost_1_34_0</span></tt>$ bjam --build-dir=~/build-boost --prefix=~/boost
- </pre>
- <p>In either case, Boost.Build will place the Boost binaries in the
- <tt class="docutils literal"><span class="pre">stage/</span></tt> subdirectory of your <em>build directory</em>.</p>
- </div>
- <div class="section">
- <h3><a class="toc-backref" href="#id36" id="stage" name="stage">4.4.5 <tt class="docutils literal"><span class="pre">stage</span></tt></a></h3>
- <p>You already have the Boost headers on your system (in the
- <tt class="docutils literal"><span class="pre">boost/</span></tt> subdirectory of your Boost distribution), so if you
- prefer not to create an additional copy, instead of installing
- Boost you can simply “stage” the Boost binaries, which leaves them
- in the <tt class="docutils literal"><span class="pre">stage/</span></tt> subdirectory of your chosen <a class="reference" href="#build-directory">build directory</a>:</p>
- <pre class="literal-block">
- bjam --build-dir=<a class="reference" href="#id10"><em>build-directory</em></a> <strong>\</strong>
- --toolset=<a class="reference" href="#toolset-name"><em>toolset-name</em></a> stage
- </pre>
- </div>
- <div class="section">
- <h3><a class="toc-backref" href="#id37" id="select-a-prefix-directory" name="select-a-prefix-directory"><span id="id11"></span><span id="prefix-directory"></span>4.4.6 Select a Prefix Directory</a></h3>
- <p>Choose a <strong>prefix directory</strong>. The installation process will
- leave you with the following subdirectories of the prefix directory:</p>
- <ul class="simple">
- <li><tt class="docutils literal"><span class="pre">lib</span></tt>, containing the Boost binaries</li>
- <li><tt class="docutils literal"><span class="pre">include/</span></tt><tt class="docutils literal"><span class="pre">boost_1_34_0</span></tt>, containing the Boost headers.</li>
- </ul>
- <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 --build-dir=<a class="reference" href="#id10"><em>build-directory</em></a> <strong>\</strong>
- --toolset=<a class="reference" href="#toolset-name"><em>toolset-name</em></a> <strong>\</strong>
- --prefix=<a class="reference" href="#id11"><em>prefix-directory</em></a> install
- </pre>
- <p>For example, on Windows your session might look like:</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_34_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_34_0</span></tt>> bjam <strong>\</strong>
- --build-dir=C:\TEMP\build-boost <strong>\</strong>
- --prefix=C:\boost
- </pre>
- <p>And on Unix:</p>
- <pre class="literal-block">
- ~$ cd ~/<tt class="docutils literal"><span class="pre">boost_1_34_0</span></tt>
- ~/<tt class="docutils literal"><span class="pre">boost_1_34_0</span></tt>$ bjam --build-dir=/tmp/build-boost <strong>\</strong>
- --prefix=~/boost
- </pre>
- </div>
- </div>
- </div>
- <div class="section">
- <h1><a class="toc-backref" href="#id38" id="linking-a-program-with-a-boost-library" name="linking-a-program-with-a-boost-library">5 Linking A Program with 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" href="../libs/regex">Boost.Regex</a> library, which has a
- separately-compiled binary component.</p>
- <pre class="literal-block">
- #include <boost/regex.hpp>
- #include <iostream>
- #include <string>
- int main()
- {
- std::string line;
- boost::regex pat( "^Subject: (Re: |Aw: )*(.*)" );
- while (std::cin)
- {
- std::getline(std::cin, line);
- boost::smatch matches;
- if (boost::regex_match(line, matches, pat))
- std::cout << matches[2];
- }
- }
- </pre>
- <p>There are two main challenges associated with linking:</p>
- <ol class="arabic simple">
- <li>Tool configuration, e.g. choosing command-line options or IDE
- build settings.</li>
- <li>Identifying the library binary, among all the build variants,
- whose compile configuration is compatible with the rest of your
- project.</li>
- </ol>
- <div class="section">
- <h2><a class="toc-backref" href="#id39" id="microsoft-windows" name="microsoft-windows">5.1 Microsoft Windows</a></h2>
- <p>Most Windows compilers and linkers have so called “auto-linking
- support,” which is used by many Boost libraries to eliminate the
- second challenge. Special code in Boost header files detects your
- compiler options and uses that information to encode the name of
- the correct library into your object files; the linker selects the
- library with that name from the directories you've told it to
- search.</p>
- <div class="note">
- <p class="first admonition-title">Note</p>
- <p>As of this writing, a few Boost libraries don't support
- auto-linking:</p>
- <ul class="last simple">
- <li>Boost.Python</li>
- <li>…others?…</li>
- </ul>
- </div>
- <div class="section">
- <h3><a class="toc-backref" href="#id40" id="visual-c-command-line" name="visual-c-command-line">5.1.1 Visual C++ Command Line</a></h3>
- <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_34_0</span></tt><tt class="docutils literal"><span class="pre">\lib</span></tt>:</p>
- <pre class="literal-block">
- C:PROMPT> cl /EHsc /I <em>C:</em><tt class="docutils literal"><span class="pre">\</span></tt><em>path</em><tt class="docutils literal"><span class="pre">\</span></tt><em>to</em><tt class="docutils literal"><span class="pre">\</span></tt><tt class="docutils literal"><span class="pre">boost_1_34_0</span></tt> example.cpp <strong>\</strong>
- <strong>/link /LIBPATH:</strong> <strong>C:\Program Files\boost\</strong><strong>boost_1_34_0</strong><strong>\lib</strong>
- </pre>
- <p>To link with a library that doesn't use auto-linking support, you
- need to specify the library name. For example,</p>
- <pre class="literal-block">
- C:PROMPT> cl /EHsc /I <em>C:</em><tt class="docutils literal"><span class="pre">\</span></tt><em>path</em><tt class="docutils literal"><span class="pre">\</span></tt><em>to</em><tt class="docutils literal"><span class="pre">\</span></tt><tt class="docutils literal"><span class="pre">boost_1_34_0</span></tt> example.cpp <strong>\</strong>
- /link /LIBPATH: <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_34_0</span></tt> <strong>\</strong>
- <strong>boost_regex-msvc-7.1-mt-d-1_34.lib</strong>
- </pre>
- <p>See <a class="reference" href="#library-naming">Library Naming</a> for details about how to select the right
- library name.</p>
- </div>
- <div class="section">
- <h3><a class="toc-backref" href="#id41" id="visual-studio-ide" name="visual-studio-ide">5.1.2 Visual Studio IDE</a></h3>
- <p>Starting with the <a class="reference" href="#vs-header-only">header-only example project</a> we created
- earlier:</p>
- <ol class="arabic simple">
- <li>Right-click <strong>example</strong> in the <em>Solution Explorer</em> pane and
- 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_34_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>To link with a library that doesn't use auto-linking support,
- before building (step 3 above), you also need to specify the library
- name:</p>
- <ul class="simple">
- <li>In <em>Configuration Properties</em> > <em>Linker</em> > <em>Input</em> >
- <em>Additional Dependencies</em>, enter the name of the binary library
- to link with, e.g. <strong>boost_regex-msvc-7.1-mt-d-1_34.lib</strong>.</li>
- </ul>
- <p>See <a class="reference" href="#library-naming">Library Naming</a> for details about how to select the right
- library name.</p>
- </div>
- </div>
- <div class="section">
- <h2><a class="toc-backref" href="#id42" id="id13" name="id13">5.2 *nix (e.g. Unix, Linux, MacOS, Cygwin)</a></h2>
- <p>There are two main ways to link to libraries:</p>
- <ol class="loweralpha">
- <li><p class="first">You can specify the full path to each library:</p>
- <pre class="literal-block">
- $ c++ -I <tt class="docutils literal"><span class="pre">/</span></tt><em>path</em><tt class="docutils literal"><span class="pre">/</span></tt><em>to</em><tt class="docutils literal"><span class="pre">/</span></tt><tt class="docutils literal"><span class="pre">boost_1_34_0</span></tt> example.cpp -o example <strong>\</strong>
- <strong>~/boost/lib/libboost_regex-msvc-7.1-mt-d-1_34.a</strong>
- </pre>
- </li>
- <li><p class="first">You can separately specify a directory to search (with <tt class="docutils literal"><span class="pre">-L</span></tt><em>directory</em>) and a library name to search for (with <tt class="docutils literal"><span class="pre">-l</span></tt><em>library</em>,<a class="footnote-reference" href="#lowercase-l" id="id14" name="id14"><sup>4</sup></a> dropping the filename's leading <tt class="docutils literal"><span class="pre">lib</span></tt> and trailing
- suffix (<tt class="docutils literal"><span class="pre">.a</span></tt> in this case):</p>
- <pre class="literal-block">
- $ c++ -I <tt class="docutils literal"><span class="pre">/</span></tt><em>path</em><tt class="docutils literal"><span class="pre">/</span></tt><em>to</em><tt class="docutils literal"><span class="pre">/</span></tt><tt class="docutils literal"><span class="pre">boost_1_34_0</span></tt> example.cpp -o example <strong>\</strong>
- <strong>-L~/boost/lib/ -lboost_regex-msvc-7.1-mt-d-1_34</strong>
- </pre>
- <p>As you can see, this method is just as terse as method a. for
- one library; it <em>really</em> pays off when you're using multiple
- libraries from the same directory.</p>
- </li>
- </ol>
- <p>In both cases above, the bold text is what you'd add to <a class="reference" href="#unix-header-only">the
- command lines we explored earlier</a>.</p>
- </div>
- <div class="section">
- <h2><a class="toc-backref" href="#id43" id="library-naming" name="library-naming">5.3 Library Naming</a></h2>
- <p>In order to choose the right library binary to link with, you'll
- need to know something about how Boost libraries are named. Each
- library binary filename is composed of a common sequence of
- elements that describe how it was built. For example,
- <tt class="docutils literal"><span class="pre">libboost_regex-msvc-7.1-mt-d-1_34.lib</span></tt> can be broken down into the
- following elements:</p>
- <dl class="docutils">
- <dt><tt class="docutils literal"><span class="pre">lib</span></tt></dt>
- <dd><em>Prefix</em>: except on Microsoft Windows, every Boost library
- name begins with this string. On Windows, only ordinary static
- libraries use the <tt class="docutils literal"><span class="pre">lib</span></tt> prefix; import libraries and DLLs do
- not.<a class="footnote-reference" href="#distinct" id="id16" name="id16"><sup>5</sup></a></dd>
- <dt><tt class="docutils literal"><span class="pre">boost_regex</span></tt></dt>
- <dd><em>Library name</em>: all boost library filenames begin with <tt class="docutils literal"><span class="pre">boost_</span></tt>.</dd>
- <dt><tt class="docutils literal"><span class="pre">-msvc-7.1</span></tt></dt>
- <dd><em>Toolset tag</em>: one of the <a class="reference" href="#toolset-name">Boost.Build toolset names</a>,
- possibly followed by a dash and a version number.</dd>
- <dt><tt class="docutils literal"><span class="pre">-mt</span></tt></dt>
- <dd><em>Threading tag</em>: indicates that the library was
- built with multithreading support enabled. Libraries built
- without multithreading support can be identified by the absence
- of <tt class="docutils literal"><span class="pre">-mt</span></tt>.</dd>
- <dt><tt class="docutils literal"><span class="pre">-d</span></tt></dt>
- <dd><p class="first"><em>ABI tag</em>: encodes details that affect the library's
- interoperability with other compiled code. For each such
- feature, a single letter is added to the tag:</p>
- <table border="1" class="docutils">
- <colgroup>
- <col width="6%" />
- <col width="94%" />
- </colgroup>
- <thead valign="bottom">
- <tr><th class="head">Key</th>
- <th class="head">Use this library when:</th>
- </tr>
- </thead>
- <tbody valign="top">
- <tr><td><tt class="docutils literal"><span class="pre">s</span></tt></td>
- <td>linking statically to the C++ standard library and compiler runtime support
- libraries.</td>
- </tr>
- <tr><td><tt class="docutils literal"><span class="pre">g</span></tt></td>
- <td>using debug versions of the standard and runtime support libraries.</td>
- </tr>
- <tr><td><tt class="docutils literal"><span class="pre">y</span></tt></td>
- <td>using a special <a class="reference" href="../libs/python/doc/building.html#variants">debug build of Python</a>.</td>
- </tr>
- <tr><td><tt class="docutils literal"><span class="pre">d</span></tt></td>
- <td>building a debug version of your code.<a class="footnote-reference" href="#debug-abi" id="id17" name="id17"><sup>6</sup></a></td>
- </tr>
- <tr><td><tt class="docutils literal"><span class="pre">p</span></tt></td>
- <td>using the STLPort standard library rather than the default one supplied with
- your compiler.</td>
- </tr>
- <tr><td><tt class="docutils literal"><span class="pre">n</span></tt></td>
- <td>using STLPort's deprecated “native iostreams” feature.<a class="footnote-reference" href="#native" id="id18" name="id18"><sup>7</sup></a></td>
- </tr>
- </tbody>
- </table>
- <p class="last">For example, if you build a debug version of your code for use
- with debug versions of the static runtime library and the
- STLPort standard library in “native iostreams” mode,
- the tag would be: <tt class="docutils literal"><span class="pre">-sgdpn</span></tt>. If none of the above apply, the
- ABI tag is ommitted.</p>
- </dd>
- <dt><tt class="docutils literal"><span class="pre">-1_34</span></tt></dt>
- <dd><em>Version tag</em>: the full Boost release number,
- with periods replaced by underscores. The major and minor version
- numbers are taken together separated by an underscore. For
- example, version 1.31.1 would be tagged as "-1_31_1".</dd>
- <dt><tt class="docutils literal"><span class="pre">.lib</span></tt></dt>
- <dd><em>Extension</em>: determined according to the
- operating system's usual convention. On Windows, <tt class="docutils literal"><span class="pre">.dll</span></tt>
- indicates a shared library and <tt class="docutils literal"><span class="pre">.lib</span></tt> indicates a static or
- import library. On most *nix platforms the extensions are
- <tt class="docutils literal"><span class="pre">.a</span></tt> and <tt class="docutils literal"><span class="pre">.so</span></tt> for static libraries (archives) and shared
- libraries, respectively. Where supported by *nix toolsets, a
- full version extension is added (e.g. ".so.1.34"); a symbolic
- link to the library file, named without the trailing version
- number, will also be created.</dd>
- </dl>
- <hr class="docutils" />
- <table class="docutils footnote" frame="void" id="packagers" rules="none">
- <colgroup><col class="label" /><col /></colgroup>
- <tbody valign="top">
- <tr><td class="label"><a class="fn-backref" href="#id3" name="packagers">[1]</a></td><td>If developers of Boost packages would like to work
- with us to make sure these instructions can be used with their
- packages, we'd be glad to help. Please make your interest known
- to the <a class="reference" href="mailing_lists.htm#main">Boost developers' list</a>.</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"><a class="fn-backref" href="#id4" name="installer-src">[2]</a></td><td>If you used the <a class="reference" href="http://www.boost-consulting.com/download.html">Windows 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
- you won't be able to rebuild libraries from scratch.</td></tr>
- </tbody>
- </table>
- <table class="docutils footnote" frame="void" id="pch" rules="none">
- <colgroup><col class="label" /><col /></colgroup>
- <tbody valign="top">
- <tr><td class="label"><a class="fn-backref" href="#id6" name="pch">[3]</a></td><td>There's no problem using Boost with precompiled headers;
- these instructions merely avoid precompiled headers because it
- would require Visual Studio-specific changes to the source code
- used in the examples.</td></tr>
- </tbody>
- </table>
- <table class="docutils footnote" frame="void" id="lowercase-l" rules="none">
- <colgroup><col class="label" /><col /></colgroup>
- <tbody valign="top">
- <tr><td class="label"><a class="fn-backref" href="#id14" name="lowercase-l">[4]</a></td><td>That option is a dash followed by a lowercase “L”
- character, which looks very much like a numeral 1 in some fonts.</td></tr>
- </tbody>
- </table>
- <table class="docutils footnote" frame="void" id="distinct" rules="none">
- <colgroup><col class="label" /><col /></colgroup>
- <tbody valign="top">
- <tr><td class="label"><a class="fn-backref" href="#id16" name="distinct">[5]</a></td><td>This convention distinguishes the static version of
- a Boost library from the import library for an
- identically-configured Boost DLL, which would otherwise have the
- same name.</td></tr>
- </tbody>
- </table>
- <table class="docutils footnote" frame="void" id="debug-abi" rules="none">
- <colgroup><col class="label" /><col /></colgroup>
- <tbody valign="top">
- <tr><td class="label"><a class="fn-backref" href="#id17" name="debug-abi">[6]</a></td><td>These libraries were compiled without optimization
- or inlining, with full debug symbols enabled, and without
- <tt class="docutils literal"><span class="pre">NDEBUG</span></tt> <tt class="docutils literal"><span class="pre">#define</span></tt>d. All though it's true that sometimes
- these choices don't affect binary compatibility with other
- compiled code, you can't count on that with Boost libraries.</td></tr>
- </tbody>
- </table>
- <table class="docutils footnote" frame="void" id="native" rules="none">
- <colgroup><col class="label" /><col /></colgroup>
- <tbody valign="top">
- <tr><td class="label"><a class="fn-backref" href="#id18" name="native">[7]</a></td><td>This feature of STLPort is deprecated because it's
- impossible to make it work transparently to the user; we don't
- recommend it.</td></tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- <div class="footer">
- <hr class="footer" />
- <a class="reference" href="./getting_started.rst">View document source</a>.
- Generated on: 2006-11-20 13:06 UTC.
- Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
- </div>
- </body>
- </html>
|