[29] | 1 | ============================ |
---|
| 2 | |(logo)|__ Getting Started |
---|
| 3 | ============================ |
---|
| 4 | |
---|
| 5 | .. |(logo)| image:: ../boost.png |
---|
| 6 | :alt: Boost |
---|
| 7 | :class: boost-logo |
---|
| 8 | |
---|
| 9 | __ ../index.htm |
---|
| 10 | |
---|
| 11 | |
---|
| 12 | .. section-numbering:: |
---|
| 13 | :depth: 2 |
---|
| 14 | |
---|
| 15 | .. contents:: Contents |
---|
| 16 | :depth: 2 |
---|
| 17 | :class: sidebar small |
---|
| 18 | |
---|
| 19 | .. ## Update this substitution for each release |
---|
| 20 | |
---|
| 21 | .. |boost_ver| replace:: ``boost_1_34_0`` |
---|
| 22 | .. |boost_ver-bold| replace:: **boost_1_34_0** |
---|
| 23 | |
---|
| 24 | .. |root| replace:: ``/``\ *path*\ ``/``\ *to*\ ``/``\ |boost_ver| |
---|
| 25 | .. |winroot| replace:: *path*\ ``\``\ *to*\ ``\``\ |boost_ver| |
---|
| 26 | .. |winroot-default| replace:: ``C:\Program``\ `` ``\ ``Files\boost\``\ |boost_ver| |
---|
| 27 | .. |bold-winroot-default| replace:: **C:\\Program Files\\boost\\**\ |boost_ver-bold| |
---|
| 28 | |
---|
| 29 | Introduction |
---|
| 30 | ============ |
---|
| 31 | |
---|
| 32 | Welcome to the Boost libraries! By the time you've completed this |
---|
| 33 | tutorial, you'll be at least somewhat comfortable with the contents |
---|
| 34 | of a Boost distribution and how to go about using it. |
---|
| 35 | |
---|
| 36 | What's Here |
---|
| 37 | ----------- |
---|
| 38 | |
---|
| 39 | This document is designed to be an *extremely* gentle introduction, |
---|
| 40 | so we included a fair amount of material that may already be very |
---|
| 41 | familiar to you. To keep things simple, we also left out some |
---|
| 42 | information intermediate and advanced users will probably want. At |
---|
| 43 | the end of this document, we'll refer you on to resources that can |
---|
| 44 | help you pursue these topics further. |
---|
| 45 | |
---|
| 46 | Preliminaries |
---|
| 47 | ------------- |
---|
| 48 | |
---|
| 49 | We use one typographic convention that might not be immediately |
---|
| 50 | obvious: *italic* text in examples is meant as a descriptive |
---|
| 51 | placeholder for something else, usually information that you'll |
---|
| 52 | provide. For example: |
---|
| 53 | |
---|
| 54 | .. parsed-literal:: |
---|
| 55 | |
---|
| 56 | **$** echo "My name is *your name*\ " |
---|
| 57 | |
---|
| 58 | Here you're expected to imagine replacing the text “your name” with |
---|
| 59 | your actual name. |
---|
| 60 | |
---|
| 61 | We identify Unix and its variants such as Linux, FreeBSD, and MacOS |
---|
| 62 | collectively as \*nix. If you're not targeting Microsoft Windows, |
---|
| 63 | the instructions for \*nix users will probably work for you. |
---|
| 64 | Cygwin users working from the Cygwin ``bash`` prompt should also |
---|
| 65 | follow the \*nix instructions. To use your Cygwin compiler from |
---|
| 66 | the Windows command prompt, follow the instructions for Windows |
---|
| 67 | users. |
---|
| 68 | |
---|
| 69 | Although Boost supports a wide variety of Windows compilers |
---|
| 70 | (including older Microsoft compilers), most instructions for |
---|
| 71 | Windows users cover only the Visual Studio .NET 2003 and Visual |
---|
| 72 | Studio 2005. We hope that gives you enough information to adapt |
---|
| 73 | them for your own compiler or IDE. |
---|
| 74 | |
---|
| 75 | Get Boost |
---|
| 76 | ========= |
---|
| 77 | |
---|
| 78 | There are basically three ways to get Boost on your system: |
---|
| 79 | |
---|
| 80 | 1. **Windows Installer**: Boost Consulting provides an installer_ |
---|
| 81 | for Windows platforms that installs a complete Boost |
---|
| 82 | distribution, plus optional precompiled library binaries for |
---|
| 83 | Visual Studio, and (optionally) a prebuilt version of the |
---|
| 84 | ``bjam`` build tool. |
---|
| 85 | |
---|
| 86 | .. _Windows installer: http://www.boost-consulting.com/download.html |
---|
| 87 | .. |Windows installer| replace:: **Windows installer** |
---|
| 88 | .. _Boost Consulting: http://boost-consulting.com |
---|
| 89 | .. _installer: `Windows installer`_ |
---|
| 90 | |
---|
| 91 | |
---|
| 92 | 2. **Download**: users of other platforms—and Windows |
---|
| 93 | users who prefer to build everything from scratch—can `download |
---|
| 94 | a complete Boost distribution`__ from SourceForge. |
---|
| 95 | |
---|
| 96 | .. ## Update this link for each release |
---|
| 97 | __ http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=8041&release_id=376197 |
---|
| 98 | |
---|
| 99 | - **Windows**: Download and run |boost_ver|\ ``.exe`` |
---|
| 100 | to unpack the distribution. [#zip]_ |
---|
| 101 | |
---|
| 102 | - ***nix**: Download |boost_ver|\ ``.tar.bz2``. Then, in the |
---|
| 103 | directory where you want to put the Boost installation, |
---|
| 104 | execute |
---|
| 105 | |
---|
| 106 | .. parsed-literal:: |
---|
| 107 | |
---|
| 108 | tar --bzip2 -xf */path/to/*\ |boost_ver|\ .tar.bz2 |
---|
| 109 | |
---|
| 110 | 3. **Boost packages** from RedHat, Debian, or some other |
---|
| 111 | distribution packager: these instructions may not work for you |
---|
| 112 | if you use 3rd party packages, because other packagers sometimes |
---|
| 113 | choose to break Boost up into several packages or to reorganize |
---|
| 114 | the directory structure of the Boost distribution. [#packagers]_ |
---|
| 115 | |
---|
| 116 | The Structure of a Boost Distribution |
---|
| 117 | ===================================== |
---|
| 118 | |
---|
| 119 | This is is a sketch of the directory structure you'll get when you |
---|
| 120 | unpack your Boost installation (windows users replace forward |
---|
| 121 | slashes with backslashes): |
---|
| 122 | |
---|
| 123 | .. parsed-literal:: |
---|
| 124 | |
---|
| 125 | |boost_ver-bold|\ **/** .................\ *The “boost root directory”* |
---|
| 126 | **index.htm** .........\ *A copy of www.boost.org starts here* |
---|
| 127 | **boost/** .........................\ *All Boost Header files* |
---|
| 128 | **libs/** ............\ *Tests, .cpp*\ s\ *, docs, etc., by library* [#installer-src]_ |
---|
| 129 | **index.html** ........\ *Library documentation starts here* |
---|
| 130 | **algorithm/** |
---|
| 131 | **any/** |
---|
| 132 | **array/** |
---|
| 133 | *…more libraries…* |
---|
| 134 | **status/** .........................\ *Boost-wide test suite* |
---|
| 135 | **tools/** ...........\ *Utilities, e.g. bjam, quickbook, bcp* |
---|
| 136 | **more/** ..........................\ *Policy documents, etc.* |
---|
| 137 | **doc/** ...............\ *A subset of all Boost library docs* |
---|
| 138 | |
---|
| 139 | .. sidebar:: Header Organization |
---|
| 140 | :class: small |
---|
| 141 | |
---|
| 142 | The organization of Boost library headers isn't entirely uniform, |
---|
| 143 | but most libraries follow a few patterns: |
---|
| 144 | |
---|
| 145 | * Some older libraries and most very small libraries place all |
---|
| 146 | public headers directly into ``boost/``. |
---|
| 147 | |
---|
| 148 | * Most libraries' public headers live in a subdirectory of |
---|
| 149 | ``boost/`` named after the library. For example, you'll find |
---|
| 150 | the Type Traits Library's ``is_void.hpp`` header in |
---|
| 151 | ``boost/type_traits/is_void.hpp``. |
---|
| 152 | |
---|
| 153 | * Some libraries have an “aggregate header” in ``boost/`` that |
---|
| 154 | ``#include``\ s all of the library's other headers. For |
---|
| 155 | example, Boost.Python_'s aggregate header is |
---|
| 156 | ``boost/python.hpp``. |
---|
| 157 | |
---|
| 158 | * Most libraries place private headers in a subdirectory called |
---|
| 159 | ``detail/`` or ``aux_/``. Don't look in these directories and |
---|
| 160 | expect to find anything you can use. |
---|
| 161 | |
---|
| 162 | A few things are worth noting right off the bat: |
---|
| 163 | |
---|
| 164 | 1. The path to the “boost root directory” is sometimes referred to |
---|
| 165 | as ``$BOOST_ROOT`` in documentation and mailing lists. If you |
---|
| 166 | used the Windows installer, that will usually be |winroot-default|. |
---|
| 167 | |
---|
| 168 | 2. To compile anything in Boost, you need a directory containing |
---|
| 169 | the ``boost/`` subdirectory in your ``#include`` path. For most |
---|
| 170 | compilers, that means adding |
---|
| 171 | |
---|
| 172 | .. parsed-literal:: |
---|
| 173 | |
---|
| 174 | -I\ |root| |
---|
| 175 | |
---|
| 176 | to the command line. Specific steps for setting up ``#include`` |
---|
| 177 | paths in Microsoft Visual Studio follow later in this document; |
---|
| 178 | if you use another IDE, please consult your product's |
---|
| 179 | documentation for instructions. |
---|
| 180 | |
---|
| 181 | 3. Since all of Boost's header files have the ``.hpp`` extension, |
---|
| 182 | and live in the ``boost/`` subdirectory of the boost root, your |
---|
| 183 | Boost ``#include`` directives will look like: |
---|
| 184 | |
---|
| 185 | .. parsed-literal:: |
---|
| 186 | |
---|
| 187 | #include <boost/\ *whatever*\ .hpp> |
---|
| 188 | |
---|
| 189 | or |
---|
| 190 | |
---|
| 191 | .. parsed-literal:: |
---|
| 192 | |
---|
| 193 | #include "boost/\ *whatever*\ .hpp" |
---|
| 194 | |
---|
| 195 | depending on your religion as regards the use of angle bracket |
---|
| 196 | includes. Even Windows users can use forward slashes in |
---|
| 197 | ``#include`` directives; your compiler doesn't care. |
---|
| 198 | |
---|
| 199 | 4. Don't be distracted by the ``doc/`` subdirectory; it only |
---|
| 200 | contains a subset of the Boost documentation. Start with |
---|
| 201 | ``libs/index.html`` if you're looking for the whole enchilada. |
---|
| 202 | |
---|
| 203 | Header-Only Libraries |
---|
| 204 | ===================== |
---|
| 205 | |
---|
| 206 | The first thing many people want to know is, “how do I build |
---|
| 207 | Boost?” The good news is that often, there's nothing to build. |
---|
| 208 | |
---|
| 209 | .. admonition:: Nothing to Build |
---|
| 210 | |
---|
| 211 | Most Boost libraries are **header-only**: they consist *entirely |
---|
| 212 | of header files* containing templates and inline functions, and |
---|
| 213 | require no separately-compiled library binaries or special |
---|
| 214 | treatment when linking. |
---|
| 215 | |
---|
| 216 | .. _separate: |
---|
| 217 | |
---|
| 218 | The only Boost libraries that can't be used without separate |
---|
| 219 | compilation are: |
---|
| 220 | |
---|
| 221 | * Boost.Filesystem |
---|
| 222 | * Boost.IOStreams |
---|
| 223 | * Boost.ProgramOptions |
---|
| 224 | * Boost.Python_ |
---|
| 225 | * Boost.Regex |
---|
| 226 | * Boost.Serialization |
---|
| 227 | * Boost.Signals |
---|
| 228 | * Boost.Test |
---|
| 229 | * Boost.Thread |
---|
| 230 | * Boost.Wave |
---|
| 231 | |
---|
| 232 | The DateTime library has a separately-compiled component that |
---|
| 233 | is only needed if you're using its to/from_string and/or |
---|
| 234 | serialization features or if you're targeting Visual C++ 6.x or |
---|
| 235 | Borland. The Graph library also has a separately-compiled part, |
---|
| 236 | but you won't need it unless you intend to `parse GraphViz |
---|
| 237 | files`__. |
---|
| 238 | |
---|
| 239 | __ ../libs/graph/doc/read_graphviz.html |
---|
| 240 | |
---|
| 241 | .. ## Keep the list of non-header-only libraries up-to-date |
---|
| 242 | |
---|
| 243 | Build a Simple Program Using Boost |
---|
| 244 | ================================== |
---|
| 245 | |
---|
| 246 | To keep things simple, let's start by using a header-only library. |
---|
| 247 | The following program reads a sequence of integers from standard |
---|
| 248 | input, uses Boost.Lambda to multiply each number by three, and |
---|
| 249 | writes them to standard output:: |
---|
| 250 | |
---|
| 251 | #include <boost/lambda/lambda.hpp> |
---|
| 252 | #include <iostream> |
---|
| 253 | #include <iterator> |
---|
| 254 | #include <algorithm> |
---|
| 255 | |
---|
| 256 | int main() |
---|
| 257 | { |
---|
| 258 | using namespace boost::lambda; |
---|
| 259 | typedef std::istream_iterator<int> in; |
---|
| 260 | |
---|
| 261 | std::for_each( |
---|
| 262 | in(std::cin), in(), std::cout << (_1 * 3) << " " ); |
---|
| 263 | } |
---|
| 264 | |
---|
| 265 | Copy the text of this program into a file called ``example.cpp``. |
---|
| 266 | |
---|
| 267 | .. _unix-header-only: |
---|
| 268 | |
---|
| 269 | Build on \*nix |
---|
| 270 | -------------- |
---|
| 271 | |
---|
| 272 | In the directory where you saved ``example.cpp``, issue the |
---|
| 273 | following command: |
---|
| 274 | |
---|
| 275 | .. parsed-literal:: |
---|
| 276 | |
---|
| 277 | c++ -I |root| example.cpp -o example |
---|
| 278 | |
---|
| 279 | To test the result, type: |
---|
| 280 | |
---|
| 281 | .. parsed-literal:: |
---|
| 282 | |
---|
| 283 | echo 1 2 3 | ./example |
---|
| 284 | |
---|
| 285 | .. |next| replace:: *next...* |
---|
| 286 | |
---|
| 287 | |next|__ |
---|
| 288 | |
---|
| 289 | __ `Errors and Warnings`_ |
---|
| 290 | |
---|
| 291 | Build from the Visual Studio Command Prompt |
---|
| 292 | ------------------------------------------- |
---|
| 293 | |
---|
| 294 | From your computer's *Start* menu, if you are a Visual |
---|
| 295 | Studio 2005 user, select |
---|
| 296 | |
---|
| 297 | *All Programs* > *Microsoft Visual Studio 2005* |
---|
| 298 | > *Visual Studio Tools* > *Visual Studio 2005 Command Prompt* |
---|
| 299 | |
---|
| 300 | or, if you're a Visual Studio .NET 2003 user, select |
---|
| 301 | |
---|
| 302 | *All Programs* > *Microsoft Visual Studio .NET 2003* |
---|
| 303 | > *Visual Studio .NET Tools* > *Visual Studio .NET 2003 Command Prompt* |
---|
| 304 | |
---|
| 305 | to bring up a special `command prompt`_ window set up for the Visual |
---|
| 306 | Studio compiler. In that window, type the following command and |
---|
| 307 | hit the return key: |
---|
| 308 | |
---|
| 309 | .. parsed-literal:: |
---|
| 310 | |
---|
| 311 | cl /EHsc /I\ |winroot| *path*\ \\\ *to*\ \\example.cpp |
---|
| 312 | |
---|
| 313 | To test the result, type: |
---|
| 314 | |
---|
| 315 | .. parsed-literal:: |
---|
| 316 | |
---|
| 317 | echo 1 2 3 | example |
---|
| 318 | |
---|
| 319 | |next|__ |
---|
| 320 | |
---|
| 321 | __ `Errors and Warnings`_ |
---|
| 322 | |
---|
| 323 | .. _vs-header-only: |
---|
| 324 | |
---|
| 325 | Build in the Visual Studio IDE |
---|
| 326 | ------------------------------ |
---|
| 327 | |
---|
| 328 | * From Visual Studio's *File* menu, select *New* > *Project…* |
---|
| 329 | * In the left-hand pane of the resulting *New Project* dialog, |
---|
| 330 | select *Visual C++* > *Win32*. |
---|
| 331 | * In the right-hand pane, select *Win32 Console Application* |
---|
| 332 | (VS8.0) or *Win32 Console Project* (VS7.1). |
---|
| 333 | * In the *name* field, enter “example” |
---|
| 334 | * Right-click **example** in the *Solution Explorer* pane and |
---|
| 335 | select *Properties* from the resulting pop-up menu |
---|
| 336 | * In *Configuration Properties* > *C/C++* > *General* > *Additional Include |
---|
| 337 | Directories*, enter the path to the Boost root directory, e.g. |
---|
| 338 | |winroot-default|. |
---|
| 339 | * In *Configuration Properties* > *C/C++* > *Precompiled Headers*, change |
---|
| 340 | *Use Precompiled Header (/Yu)* to *Not Using Precompiled |
---|
| 341 | Headers*. [#pch]_ |
---|
| 342 | * Replace the contents of the ``example.cpp`` generated by the IDE |
---|
| 343 | with the example code above. |
---|
| 344 | * From the *Build* menu, select *Build Solution*. |
---|
| 345 | |
---|
| 346 | To test your application, hit the F5 key and type the following |
---|
| 347 | into the resulting window, followed by the return key:: |
---|
| 348 | |
---|
| 349 | 1 2 3 |
---|
| 350 | |
---|
| 351 | Then hold down the control key and press "Z", followed by the |
---|
| 352 | return key. |
---|
| 353 | |
---|
| 354 | Errors and Warnings |
---|
| 355 | ------------------- |
---|
| 356 | |
---|
| 357 | Don't be alarmed if you see compiler warnings from Boost headers. |
---|
| 358 | We try to eliminate them, but doing so isn't always practical. |
---|
| 359 | [#warnings]_ |
---|
| 360 | |
---|
| 361 | Errors are another matter. If you're seeing compilation errors at |
---|
| 362 | this point in the tutorial, check to be sure you've copied the |
---|
| 363 | example program correctly and that you've correctly identified the |
---|
| 364 | Boost root directory. |
---|
| 365 | |
---|
| 366 | Get Boost Library Binaries |
---|
| 367 | ========================== |
---|
| 368 | |
---|
| 369 | If you want to use any of the separately-compiled Boost libraries, |
---|
| 370 | you'll need library binaries. |
---|
| 371 | |
---|
| 372 | Install Visual Studio Binaries |
---|
| 373 | ------------------------------ |
---|
| 374 | |
---|
| 375 | The `Windows installer`_ supplied by Boost Consulting will download |
---|
| 376 | and install pre-compiled binaries into the ``lib\`` subdirectory of |
---|
| 377 | the boost root, typically |winroot-default|\ ``\lib\``. |
---|
| 378 | |
---|
| 379 | |next|__ |
---|
| 380 | |
---|
| 381 | __ `Link Your Program to a Boost Library`_ |
---|
| 382 | |
---|
| 383 | Build and Install \*nix Binaries |
---|
| 384 | -------------------------------- |
---|
| 385 | |
---|
| 386 | Issue the following commands in the shell (don't type ``$``; it |
---|
| 387 | represents the shell's prompt): |
---|
| 388 | |
---|
| 389 | .. parsed-literal:: |
---|
| 390 | |
---|
| 391 | **$** cd |root| |
---|
| 392 | **$** ./configure --help |
---|
| 393 | |
---|
| 394 | Select your configuration options and invoke ``./configure`` again. |
---|
| 395 | Unless you have write permission in your system's ``/usr/local/`` |
---|
| 396 | directory, you'll probably want to at least use |
---|
| 397 | |
---|
| 398 | .. parsed-literal:: |
---|
| 399 | |
---|
| 400 | **$** ./configure **--prefix=**\ *path*\ /\ *to*\ /\ *installation*\ /\ *prefix* |
---|
| 401 | |
---|
| 402 | to install somewhere else. Finally, |
---|
| 403 | |
---|
| 404 | .. parsed-literal:: |
---|
| 405 | |
---|
| 406 | **$** make install |
---|
| 407 | |
---|
| 408 | which will leave Boost binaries in the ``lib/`` subdirectory of |
---|
| 409 | your installation prefix. You will also find a copy of the Boost |
---|
| 410 | headers in the ``include/`` subdirectory of the installation |
---|
| 411 | prefix, so you can henceforth use that directory as an ``#include`` |
---|
| 412 | path in place of the Boost root directory. |
---|
| 413 | |
---|
| 414 | |next|__ |
---|
| 415 | |
---|
| 416 | __ `Expected Build Output`_ |
---|
| 417 | |
---|
| 418 | Build and Install Other Binaries |
---|
| 419 | -------------------------------- |
---|
| 420 | |
---|
| 421 | If you're not using Visual C++ 7.1 or 8.0, or you're a \*nix user |
---|
| 422 | who wants want to build with a toolset other than your system's |
---|
| 423 | default, or if you want a nonstandard variant build of Boost |
---|
| 424 | (e.g. optimized, but with debug symbols), you'll need to use |
---|
| 425 | Boost.Build_ to create your own binaries. |
---|
| 426 | |
---|
| 427 | Boost.Build_ is a text-based system for developing, testing, and |
---|
| 428 | installing software. To use it, you'll need an executable called |
---|
| 429 | ``bjam``. |
---|
| 430 | |
---|
| 431 | .. |precompiled-bjam| replace:: pre-compiled ``bjam`` executables |
---|
| 432 | |
---|
| 433 | |
---|
| 434 | .. _precompiled-bjam: http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=72941 |
---|
| 435 | .. _Boost.Jam documentation: Boost.Jam_ |
---|
| 436 | .. _Boost.Build: ../tools/build/index.html |
---|
| 437 | .. _Boost.Jam: ../tools/jam/index.html |
---|
| 438 | .. _Boost.Build documentation: Boost.Build_ |
---|
| 439 | |
---|
| 440 | Get ``bjam`` |
---|
| 441 | ............ |
---|
| 442 | |
---|
| 443 | ``bjam`` is the `command-line tool`_ that drives the Boost Build |
---|
| 444 | system. To build Boost binaries, you'll invoke ``bjam`` from the |
---|
| 445 | Boost root. |
---|
| 446 | |
---|
| 447 | Boost provides |precompiled-bjam|_ for a variety of platforms. |
---|
| 448 | Alternatively, you can build ``bjam`` yourself using `these |
---|
| 449 | instructions`__. |
---|
| 450 | |
---|
| 451 | __ http://www.boost.org/doc/html/jam/building.html |
---|
| 452 | |
---|
| 453 | |
---|
| 454 | .. _toolset: |
---|
| 455 | .. _toolset-name: |
---|
| 456 | |
---|
| 457 | Identify Your Toolset |
---|
| 458 | ..................... |
---|
| 459 | |
---|
| 460 | First, find the toolset corresponding to your compiler in the |
---|
| 461 | following table. |
---|
| 462 | |
---|
| 463 | +-----------+--------------------+-----------------------------+ |
---|
| 464 | |Toolset |Vendor |Notes | |
---|
| 465 | |Name | | | |
---|
| 466 | +===========+====================+=============================+ |
---|
| 467 | |``acc`` |Hewlett Packard |Only very recent versions are| |
---|
| 468 | | | |known to work well with Boost| |
---|
| 469 | +-----------+--------------------+-----------------------------+ |
---|
| 470 | |``borland``|Borland | | |
---|
| 471 | +-----------+--------------------+-----------------------------+ |
---|
| 472 | |``como`` |Comeau Computing |Using this toolset may | |
---|
| 473 | | | |require configuring__ another| |
---|
| 474 | | | |toolset to act as its backend| |
---|
| 475 | +-----------+--------------------+-----------------------------+ |
---|
| 476 | |``cw`` |Metrowerks/FreeScale|The CodeWarrior compiler. We| |
---|
| 477 | | | |have not tested versions of | |
---|
| 478 | | | |this compiler produced since | |
---|
| 479 | | | |it was sold to FreeScale. | |
---|
| 480 | +-----------+--------------------+-----------------------------+ |
---|
| 481 | |``dmc`` |Digital Mars |As of this Boost release, no | |
---|
| 482 | | | |version of dmc is known to | |
---|
| 483 | | | |handle Boost well. | |
---|
| 484 | +-----------+--------------------+-----------------------------+ |
---|
| 485 | |``darwin`` |Apple Computer |Apple's version of the GCC | |
---|
| 486 | | | |toolchain with support for | |
---|
| 487 | | | |Darwin and MacOS X features | |
---|
| 488 | | | |such as frameworks. | |
---|
| 489 | +-----------+--------------------+-----------------------------+ |
---|
| 490 | |``gcc`` |The Gnu Project |Includes support for Cygwin | |
---|
| 491 | | | |and MinGW compilers. | |
---|
| 492 | +-----------+--------------------+-----------------------------+ |
---|
| 493 | |``hp_cxx`` |Hewlett Packard |Targeted at the Tru64 | |
---|
| 494 | | | |operating system. | |
---|
| 495 | +-----------+--------------------+-----------------------------+ |
---|
| 496 | |``intel`` |Intel | | |
---|
| 497 | +-----------+--------------------+-----------------------------+ |
---|
| 498 | |``kylix`` |Borland | | |
---|
| 499 | +-----------+--------------------+-----------------------------+ |
---|
| 500 | |``msvc`` |Microsoft | | |
---|
| 501 | +-----------+--------------------+-----------------------------+ |
---|
| 502 | |``qcc`` |QNX Software Systems| | |
---|
| 503 | +-----------+--------------------+-----------------------------+ |
---|
| 504 | |``sun`` |Sun |Only very recent versions are| |
---|
| 505 | | | |known to work well with | |
---|
| 506 | | | |Boost. | |
---|
| 507 | +-----------+--------------------+-----------------------------+ |
---|
| 508 | |``vacpp`` |IBM |The VisualAge C++ compiler. | |
---|
| 509 | +-----------+--------------------+-----------------------------+ |
---|
| 510 | |
---|
| 511 | __ Boost.Build_ |
---|
| 512 | |
---|
| 513 | If you have multiple versions of a particular compiler installed, |
---|
| 514 | you can apend the version number to the toolset name, preceded by a |
---|
| 515 | hyphen, e.g. ``msvc-7.1`` or ``gcc-3.4``. |
---|
| 516 | |
---|
| 517 | .. Note:: if you built ``bjam`` yourself, you may |
---|
| 518 | have selected a toolset name for that purpose, but that does not |
---|
| 519 | affect this step in any way; you still need to select a Boost.Build |
---|
| 520 | toolset from the table. |
---|
| 521 | |
---|
| 522 | .. _build directory: |
---|
| 523 | .. _build-directory: |
---|
| 524 | |
---|
| 525 | Select a Build Directory |
---|
| 526 | ........................ |
---|
| 527 | |
---|
| 528 | Boost.Build_ will place all intermediate files it generates while |
---|
| 529 | building into the **build directory**. If your Boost root |
---|
| 530 | directory is writable, this step isn't strictly necessary: by |
---|
| 531 | default Boost.Build will create a ``bin.v2/`` subdirectory for that |
---|
| 532 | purpose in your current working directory. |
---|
| 533 | |
---|
| 534 | Invoke ``bjam`` |
---|
| 535 | ............... |
---|
| 536 | |
---|
| 537 | .. |build-directory| replace:: *build-directory* |
---|
| 538 | .. |toolset-name| replace:: *toolset-name* |
---|
| 539 | |
---|
| 540 | Change your current directory to the Boost root directory and |
---|
| 541 | invoke ``bjam`` as follows: |
---|
| 542 | |
---|
| 543 | .. parsed-literal:: |
---|
| 544 | |
---|
| 545 | bjam **--build-dir=**\ |build-directory|_ **\\** |
---|
| 546 | **--toolset=**\ |toolset-name|_ stage |
---|
| 547 | |
---|
| 548 | For example, on Windows, your session might look like: |
---|
| 549 | |
---|
| 550 | .. parsed-literal:: |
---|
| 551 | |
---|
| 552 | C:\WINDOWS> cd |winroot-default| |
---|
| 553 | |winroot-default|> bjam **\\** |
---|
| 554 | **--build-dir=**\ %TEMP%\\build-boost **\\** |
---|
| 555 | **--toolset=msvc stage** |
---|
| 556 | |
---|
| 557 | And on Unix: |
---|
| 558 | |
---|
| 559 | .. parsed-literal:: |
---|
| 560 | |
---|
| 561 | $ cd ~/|boost_ver| |
---|
| 562 | $ bjam **--build-dir=**\ ~/build-boost **--prefix=**\ ~/boost |
---|
| 563 | |
---|
| 564 | In either case, Boost.Build will place the Boost binaries in the |
---|
| 565 | ``stage/`` subdirectory of your `build directory`_. |
---|
| 566 | |
---|
| 567 | .. Note:: ``bjam`` is case-sensitive; it is important that all the |
---|
| 568 | parts shown in **bold** type above be entirely lower-case. |
---|
| 569 | |
---|
| 570 | For a description of other options you can pass when invoking |
---|
| 571 | ``bjam``, type:: |
---|
| 572 | |
---|
| 573 | bjam --help |
---|
| 574 | |
---|
| 575 | Expected Build Output |
---|
| 576 | --------------------- |
---|
| 577 | |
---|
| 578 | During the process of building Boost libraries, you can expect to |
---|
| 579 | see some messages printed on the console. These may include |
---|
| 580 | |
---|
| 581 | * Notices about Boost library configuration—for example, the Regex |
---|
| 582 | library outputs a message about ICU when built without Unicode |
---|
| 583 | support, and the Python library may be skipped without error (but |
---|
| 584 | with a notice) if you don't have Python installed. |
---|
| 585 | |
---|
| 586 | * Messages from the build tool that report the number of targets |
---|
| 587 | that were built or skipped. Don't be surprised if those numbers |
---|
| 588 | don't make any sense to you; there are many targets per library. |
---|
| 589 | |
---|
| 590 | * Build action messages describing what the tool is doing, which |
---|
| 591 | look something like: |
---|
| 592 | |
---|
| 593 | .. parsed-literal:: |
---|
| 594 | |
---|
| 595 | *toolset-name*.c++ *long*\ /\ *path*\ /\ *to*\ /\ *file*\ /\ *being*\ /\ *built* |
---|
| 596 | |
---|
| 597 | * Compiler warnings. |
---|
| 598 | |
---|
| 599 | In Case of Build Errors |
---|
| 600 | ----------------------- |
---|
| 601 | |
---|
| 602 | The only error messages you see when building Boost—if any—should |
---|
| 603 | be related to the IOStreams library's support of zip and bzip2 |
---|
| 604 | formats as described here__. Install the relevant development |
---|
| 605 | packages for libz and libbz2 if you need those features. Other |
---|
| 606 | errors when building Boost libraries are cause for concern. |
---|
| 607 | |
---|
| 608 | If it seems like the build system can't find your compiler and/or |
---|
| 609 | linker, consider setting up a ``user-config.jam`` file as described |
---|
| 610 | in the `Boost.Build documentation`_. If that isn't your problem or |
---|
| 611 | the ``user-config.jam`` file doesn't work for you, please address |
---|
| 612 | questions about configuring Boost for your compiler to the |
---|
| 613 | `Boost.Build mailing list`_. |
---|
| 614 | |
---|
| 615 | __ file:///home/dave/src/boost/libs/iostreams/doc/installation.html |
---|
| 616 | |
---|
| 617 | Link Your Program to a Boost Library |
---|
| 618 | ==================================== |
---|
| 619 | |
---|
| 620 | To demonstrate linking with a Boost binary library, we'll use the |
---|
| 621 | following simple program that extracts the subject lines from |
---|
| 622 | emails. It uses the Boost.Regex_ library, which has a |
---|
| 623 | separately-compiled binary component. :: |
---|
| 624 | |
---|
| 625 | #include <boost/regex.hpp> |
---|
| 626 | #include <iostream> |
---|
| 627 | #include <string> |
---|
| 628 | |
---|
| 629 | int main() |
---|
| 630 | { |
---|
| 631 | std::string line; |
---|
| 632 | boost::regex pat( "^Subject: (Re: |Aw: )*(.*)" ); |
---|
| 633 | |
---|
| 634 | while (std::cin) |
---|
| 635 | { |
---|
| 636 | std::getline(std::cin, line); |
---|
| 637 | boost::smatch matches; |
---|
| 638 | if (boost::regex_match(line, matches, pat)) |
---|
| 639 | std::cout << matches[2] << std::endl; |
---|
| 640 | } |
---|
| 641 | } |
---|
| 642 | |
---|
| 643 | .. _Boost.Regex: ../libs/regex |
---|
| 644 | |
---|
| 645 | There are two main challenges associated with linking: |
---|
| 646 | |
---|
| 647 | 1. Tool configuration, e.g. choosing command-line options or IDE |
---|
| 648 | build settings. |
---|
| 649 | |
---|
| 650 | 2. Identifying the library binary, among all the build variants, |
---|
| 651 | whose compile configuration is compatible with the rest of your |
---|
| 652 | project. |
---|
| 653 | |
---|
| 654 | .. Note:: Boost.Python_ users should read that library's own `build |
---|
| 655 | documentation`__ as there are several library-specific issues to |
---|
| 656 | consider. |
---|
| 657 | |
---|
| 658 | .. _Boost.Python: ../libs/python/index.html |
---|
| 659 | __ ../libs/python/doc/building.html |
---|
| 660 | |
---|
| 661 | Link to a Boost Library on Windows |
---|
| 662 | ---------------------------------- |
---|
| 663 | |
---|
| 664 | .. _auto-linking: |
---|
| 665 | |
---|
| 666 | Most Windows compilers and linkers have so-called “auto-linking |
---|
| 667 | support,” which eliminates the second challenge. Special code in |
---|
| 668 | Boost header files detects your compiler options and uses that |
---|
| 669 | information to encode the name of the correct library into your |
---|
| 670 | object files; the linker selects the library with that name from |
---|
| 671 | the directories you've told it to search. |
---|
| 672 | |
---|
| 673 | Link to a Boost Library from the Visual Studio Command Prompt |
---|
| 674 | ............................................................. |
---|
| 675 | |
---|
| 676 | For example, we can compile and link the above program from the |
---|
| 677 | Visual C++ command-line by simply adding the **bold** text below to |
---|
| 678 | the command line we used earlier, assuming your Boost binaries are |
---|
| 679 | in |winroot-default|\ ``\lib``: |
---|
| 680 | |
---|
| 681 | .. parsed-literal:: |
---|
| 682 | |
---|
| 683 | cl /EHsc /I |winroot| example.cpp **\\** |
---|
| 684 | **/link /LIBPATH:** |bold-winroot-default|\ **\\lib** |
---|
| 685 | |
---|
| 686 | |next|__ |
---|
| 687 | |
---|
| 688 | __ `Test Your Program`_ |
---|
| 689 | |
---|
| 690 | Link to a Boost Library in the Visual Studio IDE |
---|
| 691 | ................................................ |
---|
| 692 | |
---|
| 693 | Starting with the `header-only example project`__ we created |
---|
| 694 | earlier: |
---|
| 695 | |
---|
| 696 | __ vs-header-only_ |
---|
| 697 | |
---|
| 698 | 1. Right-click **example** in the *Solution Explorer* pane and |
---|
| 699 | select *Properties* from the resulting pop-up menu |
---|
| 700 | 2. In *Configuration Properties* > *Linker* > *Additional Library |
---|
| 701 | Directories*, enter the path to the Boost binaries, |
---|
| 702 | e.g. |winroot-default|\ ``\lib\``. |
---|
| 703 | 3. From the *Build* menu, select *Build Solution*. |
---|
| 704 | |
---|
| 705 | |next|__ |
---|
| 706 | |
---|
| 707 | __ `Test Your Program`_ |
---|
| 708 | |
---|
| 709 | Link to a Boost Library On \*nix |
---|
| 710 | -------------------------------- |
---|
| 711 | |
---|
| 712 | There are two main ways to link to libraries: |
---|
| 713 | |
---|
| 714 | A. You can specify the full path to each library: |
---|
| 715 | |
---|
| 716 | .. parsed-literal:: |
---|
| 717 | |
---|
| 718 | $ c++ -I |root| example.cpp -o example **\\** |
---|
| 719 | **~/boost/lib/libboost_regex-gcc-3.4-mt-d-1_34.a** |
---|
| 720 | |
---|
| 721 | B. You can separately specify a directory to search (with ``-L``\ |
---|
| 722 | *directory*) and a library name to search for (with ``-l``\ |
---|
| 723 | *library*, [#lowercase-l]_ dropping the filename's leading ``lib`` and trailing |
---|
| 724 | suffix (``.a`` in this case): |
---|
| 725 | |
---|
| 726 | .. parsed-literal:: |
---|
| 727 | |
---|
| 728 | $ c++ -I |root| example.cpp -o example **\\** |
---|
| 729 | **-L~/boost/lib/ -lboost_regex-gcc-3.4-mt-d-1_34** |
---|
| 730 | |
---|
| 731 | As you can see, this method is just as terse as method A for one |
---|
| 732 | library; it *really* pays off when you're using multiple |
---|
| 733 | libraries from the same directory. Note, however, that if you |
---|
| 734 | use this method with a library that has both static (``.a``) and |
---|
| 735 | dynamic (``.so``) builds, the system may choose one |
---|
| 736 | automatically for you unless you pass a special option such as |
---|
| 737 | ``-static`` on the command line. |
---|
| 738 | |
---|
| 739 | In both cases above, the bold text is what you'd add to `the |
---|
| 740 | command lines we explored earlier`__. |
---|
| 741 | |
---|
| 742 | __ unix-header-only_ |
---|
| 743 | |
---|
| 744 | Library Naming |
---|
| 745 | -------------- |
---|
| 746 | |
---|
| 747 | When auto-linking is not available, you need to know how Boost |
---|
| 748 | binaries are named so you can choose the right one for your build |
---|
| 749 | configuration. Each library filename is composed of a common |
---|
| 750 | sequence of elements that describe how it was built. For example, |
---|
| 751 | ``libboost_regex-vc71-mt-d-1_34.lib`` can be broken down into the |
---|
| 752 | following elements: |
---|
| 753 | |
---|
| 754 | ``lib`` |
---|
| 755 | *Prefix*: except on Microsoft Windows, every Boost library |
---|
| 756 | name begins with this string. On Windows, only ordinary static |
---|
| 757 | libraries use the ``lib`` prefix; import libraries and DLLs do |
---|
| 758 | not. [#distinct]_ |
---|
| 759 | |
---|
| 760 | ``boost_regex`` |
---|
| 761 | *Library name*: all boost library filenames begin with ``boost_``. |
---|
| 762 | |
---|
| 763 | ``-vc71`` |
---|
| 764 | *Toolset tag*: identifies the toolset and version used to build |
---|
| 765 | the binary. |
---|
| 766 | |
---|
| 767 | ``-mt`` |
---|
| 768 | *Threading tag*: indicates that the library was |
---|
| 769 | built with multithreading support enabled. Libraries built |
---|
| 770 | without multithreading support can be identified by the absence |
---|
| 771 | of ``-mt``. |
---|
| 772 | |
---|
| 773 | ``-d`` |
---|
| 774 | *ABI tag*: encodes details that affect the library's |
---|
| 775 | interoperability with other compiled code. For each such |
---|
| 776 | feature, a single letter is added to the tag: |
---|
| 777 | |
---|
| 778 | +-----+------------------------------------------------------------------------------+ |
---|
| 779 | |Key |Use this library when: | |
---|
| 780 | +=====+==============================================================================+ |
---|
| 781 | |``s``|linking statically to the C++ standard library and compiler runtime support | |
---|
| 782 | | |libraries. | |
---|
| 783 | +-----+------------------------------------------------------------------------------+ |
---|
| 784 | |``g``|using debug versions of the standard and runtime support libraries. | |
---|
| 785 | +-----+------------------------------------------------------------------------------+ |
---|
| 786 | |``y``|using a special `debug build of Python`__. | |
---|
| 787 | +-----+------------------------------------------------------------------------------+ |
---|
| 788 | |``d``|building a debug version of your code. [#debug-abi]_ | |
---|
| 789 | +-----+------------------------------------------------------------------------------+ |
---|
| 790 | |``p``|using the STLPort standard library rather than the default one supplied with | |
---|
| 791 | | |your compiler. | |
---|
| 792 | +-----+------------------------------------------------------------------------------+ |
---|
| 793 | |``n``|using STLPort's deprecated “native iostreams” feature. [#native]_ | |
---|
| 794 | +-----+------------------------------------------------------------------------------+ |
---|
| 795 | |
---|
| 796 | For example, if you build a debug version of your code for use |
---|
| 797 | with debug versions of the static runtime library and the |
---|
| 798 | STLPort standard library in “native iostreams” mode, |
---|
| 799 | the tag would be: ``-sgdpn``. If none of the above apply, the |
---|
| 800 | ABI tag is ommitted. |
---|
| 801 | |
---|
| 802 | ``-1_34`` |
---|
| 803 | *Version tag*: the full Boost release number, with periods |
---|
| 804 | replaced by underscores. For example, version 1.31.1 would be |
---|
| 805 | tagged as "-1_31_1". |
---|
| 806 | |
---|
| 807 | ``.lib`` |
---|
| 808 | *Extension*: determined according to the operating system's usual |
---|
| 809 | convention. On most \*nix platforms the extensions are ``.a`` |
---|
| 810 | and ``.so`` for static libraries (archives) and shared libraries, |
---|
| 811 | respectively. On Windows, ``.dll`` indicates a shared library |
---|
| 812 | and—except for static libraries built by ``gcc`` toolset, whose |
---|
| 813 | names always end in ``.a``— ``.lib`` indicates a static or import |
---|
| 814 | library. Where supported by \*nix toolsets, a full version |
---|
| 815 | extension is added (e.g. ".so.1.34") and a symbolic link to the |
---|
| 816 | library file, named without the trailing version number, will |
---|
| 817 | also be created. |
---|
| 818 | |
---|
| 819 | .. _Boost.Build toolset names: toolset-name_ |
---|
| 820 | |
---|
| 821 | __ ../libs/python/doc/building.html#variants |
---|
| 822 | |
---|
| 823 | Test Your Program |
---|
| 824 | ----------------- |
---|
| 825 | |
---|
| 826 | To test our subject extraction, we'll filter the following text |
---|
| 827 | file. Copy it out of your browser and save it as ``jayne.txt``:: |
---|
| 828 | |
---|
| 829 | To: George Shmidlap |
---|
| 830 | From: Rita Marlowe |
---|
| 831 | Subject: Will Success Spoil Rock Hunter? |
---|
| 832 | --- |
---|
| 833 | See subject. |
---|
| 834 | |
---|
| 835 | Test Your Program on Microsoft Windows |
---|
| 836 | ...................................... |
---|
| 837 | |
---|
| 838 | In a `command prompt`_ window, type: |
---|
| 839 | |
---|
| 840 | .. parsed-literal:: |
---|
| 841 | |
---|
| 842 | *path*\ \\\ *to*\ \\\ *compiled*\ \\example < *path*\ \\\ *to*\ \\\ jayne.txt |
---|
| 843 | |
---|
| 844 | The program should respond with the email subject, “Will Success |
---|
| 845 | Spoil Rock Hunter?” |
---|
| 846 | |
---|
| 847 | Test Your Program on \*nix |
---|
| 848 | .......................... |
---|
| 849 | |
---|
| 850 | If you linked to a shared library, you may need to prepare some |
---|
| 851 | platform-specific settings so that the system will be able to find |
---|
| 852 | and load it when your program is run. Most platforms have an |
---|
| 853 | environment variable to which you can add the directory containing |
---|
| 854 | the library. On many platforms (Linux, FreeBSD) that variable is |
---|
| 855 | ``LD_LIBRARY_PATH``, but on MacOS it's ``DYLD_LIBRARY_PATH``, and |
---|
| 856 | on Cygwin it's simply ``PATH``. In most shells other than ``csh`` |
---|
| 857 | and ``tcsh``, you can adjust the variable as follows (again, don't |
---|
| 858 | type the ``$``\ —that represents the shell prompt): |
---|
| 859 | |
---|
| 860 | .. parsed-literal:: |
---|
| 861 | |
---|
| 862 | **$** *VARIABLE_NAME*\ =\ *path/to/lib/directory*\ :${\ *VARIABLE_NAME*\ } |
---|
| 863 | **$** export *VARIABLE_NAME* |
---|
| 864 | |
---|
| 865 | On ``csh`` and ``tcsh``, it's |
---|
| 866 | |
---|
| 867 | .. parsed-literal:: |
---|
| 868 | |
---|
| 869 | **$** setenv *VARIABLE_NAME* *path/to/lib/directory*\ :${\ *VARIABLE_NAME*\ } |
---|
| 870 | |
---|
| 871 | Once the necessary variable (if any) is set, you can run your |
---|
| 872 | program as follows: |
---|
| 873 | |
---|
| 874 | .. parsed-literal:: |
---|
| 875 | |
---|
| 876 | **$** *path*\ /\ *to*\ /\ *compiled*\ /\ example < *path*\ /\ *to*\ /\ jayne.txt |
---|
| 877 | |
---|
| 878 | The program should respond with the email subject, “Will Success |
---|
| 879 | Spoil Rock Hunter?” |
---|
| 880 | |
---|
| 881 | Conclusion and Further Resources |
---|
| 882 | ================================ |
---|
| 883 | |
---|
| 884 | This concludes your introduction to Boost and to integrating it |
---|
| 885 | with your programs. As you start using Boost in earnest, there are |
---|
| 886 | surely a few additional points you'll wish we had covered. One day |
---|
| 887 | we may have a “Book 2 in the Getting Started series” that addresses |
---|
| 888 | them. Until then, we suggest you pursue the following resources. |
---|
| 889 | If you can't find what you need, or there's anything we can do to |
---|
| 890 | make this document clearer, please post it to the `Boost Users' |
---|
| 891 | mailing list`_. |
---|
| 892 | |
---|
| 893 | * `Boost.Build reference manual`_ |
---|
| 894 | * `Boost.Jam reference manual`_ |
---|
| 895 | * `Boost Users' mailing list`_ |
---|
| 896 | * `Boost.Build mailing list`_ |
---|
| 897 | * `Boost.Build Wiki`_ |
---|
| 898 | |
---|
| 899 | .. Admonition:: Onward |
---|
| 900 | |
---|
| 901 | .. epigraph:: |
---|
| 902 | |
---|
| 903 | Good luck, and have fun! |
---|
| 904 | |
---|
| 905 | -- the Boost Developers |
---|
| 906 | |
---|
| 907 | .. _Boost.Build reference manual: ../tools/build/v2 |
---|
| 908 | .. _Boost.Jam reference manual: `Boost.Jam`_ |
---|
| 909 | .. _Boost Users' mailing list: mailing_lists.htm#users |
---|
| 910 | .. _Boost.Build Wiki: http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?Boost.Build_V2 |
---|
| 911 | .. _Boost.Build mailing list: mailing_lists.htm#jamboost |
---|
| 912 | |
---|
| 913 | |
---|
| 914 | .. _`Using command-line tools in Windows`: |
---|
| 915 | .. _`command prompt`: |
---|
| 916 | .. _`command-line tool`: |
---|
| 917 | |
---|
| 918 | Appendix: Using command-line tools in Windows |
---|
| 919 | ============================================= |
---|
| 920 | |
---|
| 921 | In Windows, a command-line tool is invoked by typing its name, |
---|
| 922 | optionally followed by arguments, into a *Command Prompt* window |
---|
| 923 | and pressing the Return (or Enter) key. |
---|
| 924 | |
---|
| 925 | To open *Command Prompt*, click the *Start* menu button, click |
---|
| 926 | *Run*, type “cmd”, and then click OK. |
---|
| 927 | |
---|
| 928 | All commands are executed within the context of a **current |
---|
| 929 | directory** in the filesystem. To set the current directory, |
---|
| 930 | type: |
---|
| 931 | |
---|
| 932 | .. parsed-literal:: |
---|
| 933 | |
---|
| 934 | cd *path*\ \\\ *to*\ \\\ *some*\ \\\ *directory* |
---|
| 935 | |
---|
| 936 | followed by Return. For example, |
---|
| 937 | |
---|
| 938 | .. parsed-literal:: |
---|
| 939 | |
---|
| 940 | cd |winroot-default| |
---|
| 941 | |
---|
| 942 | One way to name a directory you know about is to write |
---|
| 943 | |
---|
| 944 | .. parsed-literal:: |
---|
| 945 | |
---|
| 946 | %HOMEDRIVE%%HOMEPATH%\\\ *directory-name* |
---|
| 947 | |
---|
| 948 | which indicates a sibling folder of your “My Documents” folder. |
---|
| 949 | |
---|
| 950 | Long commands can be continued across several lines by typing |
---|
| 951 | backslashes at the ends of all but the last line. Many of the |
---|
| 952 | examples on this page use that technique to save horizontal |
---|
| 953 | space. |
---|
| 954 | |
---|
| 955 | ------------------------------ |
---|
| 956 | |
---|
| 957 | .. [#zip] If you prefer not to download executable programs, download |
---|
| 958 | |boost_ver|\ ``.zip`` and use an external tool to decompress |
---|
| 959 | it. We don't recommend using Windows' built-in decompression as |
---|
| 960 | it can be painfully slow for large archives. |
---|
| 961 | |
---|
| 962 | .. [#packagers] If developers of Boost packages would like to work |
---|
| 963 | with us to make sure these instructions can be used with their |
---|
| 964 | packages, we'd be glad to help. Please make your interest known |
---|
| 965 | to the `Boost developers' list`_. |
---|
| 966 | |
---|
| 967 | .. _Boost developers' list: mailing_lists.htm#main |
---|
| 968 | |
---|
| 969 | .. [#installer-src] If you used the `Windows installer`_ from Boost |
---|
| 970 | Consulting and deselected “Source and Documentation” (it's |
---|
| 971 | selected by default), you won't see the ``libs/`` subdirectory. |
---|
| 972 | That won't affect your ability to use precompiled binaries, but |
---|
| 973 | you won't be able to rebuild libraries from scratch. |
---|
| 974 | |
---|
| 975 | .. [#warnings] Remember that warnings are specific to each compiler |
---|
| 976 | implementation. The developer of a given Boost library might |
---|
| 977 | not have access to your compiler. Also, some warnings are |
---|
| 978 | extremely difficult to eliminate in generic code, to the point |
---|
| 979 | where it's not worth the trouble. Finally, some compilers don't |
---|
| 980 | have any source code mechanism for suppressing warnings. |
---|
| 981 | |
---|
| 982 | .. [#pch] There's no problem using Boost with precompiled headers; |
---|
| 983 | these instructions merely avoid precompiled headers because it |
---|
| 984 | would require Visual Studio-specific changes to the source code |
---|
| 985 | used in the examples. |
---|
| 986 | |
---|
| 987 | .. [#lowercase-l] That option is a dash followed by a lowercase “L” |
---|
| 988 | character, which looks very much like a numeral 1 in some fonts. |
---|
| 989 | |
---|
| 990 | .. [#distinct] This convention distinguishes the static version of |
---|
| 991 | a Boost library from the import library for an |
---|
| 992 | identically-configured Boost DLL, which would otherwise have the |
---|
| 993 | same name. |
---|
| 994 | |
---|
| 995 | .. [#debug-abi] These libraries were compiled without optimization |
---|
| 996 | or inlining, with full debug symbols enabled, and without |
---|
| 997 | ``NDEBUG`` ``#define``\ d. All though it's true that sometimes |
---|
| 998 | these choices don't affect binary compatibility with other |
---|
| 999 | compiled code, you can't count on that with Boost libraries. |
---|
| 1000 | |
---|
| 1001 | .. [#native] This feature of STLPort is deprecated because it's |
---|
| 1002 | impossible to make it work transparently to the user; we don't |
---|
| 1003 | recommend it. |
---|
| 1004 | |
---|