1 .. Copyright David Abrahams 2006. Distributed under the Boost
2 .. Software License, Version 1.0. (See accompanying
3 .. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 Link Your Program to a Boost Library
6 ====================================
8 To demonstrate linking with a Boost binary library, we'll use the
9 following simple program that extracts the subject lines from
10 emails. It uses the Boost.Regex_ library, which has a
11 separately-compiled binary component. ::
13 #include <boost/regex.hpp>
20 boost::regex pat( "^Subject: (Re: |Aw: )*(.*)" );
24 std::getline(std::cin, line);
25 boost::smatch matches;
26 if (boost::regex_match(line, matches, pat))
27 std::cout << matches[2] << std::endl;
31 There are two main challenges associated with linking:
33 1. Tool configuration, e.g. choosing command-line options or IDE
36 2. Identifying the library binary, among all the build variants,
37 whose compile configuration is compatible with the rest of your