Most of Boost.Iostreams can be used simply by including appropriate
headers. This is true, for instance, of all the core
components — including
— and of about two thirds of the concrete Filters
and Devices. Some components,
however, are implemented in
.cpp files; in addition, the regular expression filters depend
on Boost.Regex, and
the compressions filters rely on the third-party libraries zlib ([Gailly]),
and liblzma ([Collin]).
Note that liblzma refers to the version from xz-utils which is the version available in
for example Linux distributions, not the liblzma from the LZMA SDK from 7zip.
To obatin zlib and libbz2, see the instructions here
The components which are implemented in
.cpp or which rely
on external libraries can be built in two ways: by adding the appropriate
.cpp files to your IDE project or makefile, or by using Boost.Build.
The following table shows which headers contain components defined in
files. If your application includes one of these headers, you'll need to
add the corresponding
.cpp files to you IDE project or
makefile, and to define the preprocessor symbol
In addition, if the
.cpp file depends on an external
library, you'll have to build it from the source or link to a pre-built
|Header||Source File||External Library|
To build with Boost.Build,
run b2 from the directory
from the Boost root directory.
If you want to use the compression filters when building iostreams, you have two choices. You can setup the zlib, bzip2, zstd and/or LZMA toolsets in Boost Build in a jamfile, preferably user-config.jam, as documented in Boost.Build. Note that building from source is not supported for LZMA. Alternatively you can let iostreams setup the zlib, bzip2, zstd and/or LZMA toolsets for you using default values. The former is preferred, especially if your zlib and/or bzip2 installations cannot be found by the iostreams setup.
On most UNIX systems, it should not be necessary to setup the zlib, bzip2, zstd and/or lzma toolsets since the zlib, libbz2, libzstd and liblzma headers and binaries are already installed in locations where they will be found automatically. On Windows the zlib, bzip2, zstd and/or LZMA binaries need to be in the PATH, else they will not ordinarily be found by default, so it is always a good idea under Windows to setup the zlib, bzip2, zstd and/or LZMA toolsets in your own jamfile.
You can turn off compression filters when building iostreams by passing one of the Boost Build variables in the table below, defined to 1, using the -s option:
||Disable support for compression filters.|
||Disable support for the bzip2 filters.|
||Disable support for the zlib filters.|
||Disable support for the LZMA/xz filters.|
||Disable support for the zstd filters.|
© Copyright 2008 CodeRage,
© Copyright 2004-2007 Jonathan Turkanis
Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)