summaryrefslogtreecommitdiff
path: root/more/getting_started/windows.html
blob: c2196c3bc5fc7bc8ecf1924447d888bfaa5baa60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
<?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.11: http://docutils.sourceforge.net/" />
<title>Boost Getting Started on Windows</title>
<link rel="stylesheet" href="../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-getting-started-on-windows">
<h1 class="title"><a class="reference external" href="../../index.htm"><img alt="Boost" class="boost-logo" src="../../boost.png" /></a> Getting Started on Windows</h1>

<!-- Copyright David Abrahams 2006. 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) -->
<div class="admonition-a-note-to-cygwin-and-mingw-users admonition">
<p class="first admonition-title">A note to <a class="reference external" href="http://www.cygwin.com">Cygwin</a> and <a class="reference external" href="http://mingw.org">MinGW</a> users</p>
<p class="last">If you plan to use your tools from the Windows command prompt,
you're in the right place.  If you plan to build from the <a class="reference external" href="http://www.cygwin.com">Cygwin</a>
bash shell, you're actually running on a POSIX platform and
should follow the instructions for <a class="reference external" href="unix-variants.html">getting started on Unix
variants</a>.  Other command shells, such as <a class="reference external" href="http://mingw.org">MinGW</a>'s MSYS, are
not supported—they may or may not work.</p>
</div>
<div class="contents topic" id="index">
<p class="topic-title first">Index</p>
<ul class="auto-toc simple">
<li><a class="reference internal" href="#get-boost" id="id28">1&nbsp;&nbsp;&nbsp;Get Boost</a></li>
<li><a class="reference internal" href="#the-boost-distribution" id="id29">2&nbsp;&nbsp;&nbsp;The Boost Distribution</a></li>
<li><a class="reference internal" href="#header-only-libraries" id="id30">3&nbsp;&nbsp;&nbsp;Header-Only Libraries</a></li>
<li><a class="reference internal" href="#build-a-simple-program-using-boost" id="id31">4&nbsp;&nbsp;&nbsp;Build a Simple Program Using Boost</a><ul class="auto-toc">
<li><a class="reference internal" href="#build-from-the-visual-studio-ide" id="id32">4.1&nbsp;&nbsp;&nbsp;Build From the Visual Studio IDE</a></li>
<li><a class="reference internal" href="#or-build-from-the-command-prompt" id="id33">4.2&nbsp;&nbsp;&nbsp;Or, Build From the Command Prompt</a></li>
<li><a class="reference internal" href="#errors-and-warnings" id="id34">4.3&nbsp;&nbsp;&nbsp;Errors and Warnings</a></li>
</ul>
</li>
<li><a class="reference internal" href="#prepare-to-use-a-boost-library-binary" id="id35">5&nbsp;&nbsp;&nbsp;Prepare to Use a Boost Library Binary</a><ul class="auto-toc">
<li><a class="reference internal" href="#simplified-build-from-source" id="id36">5.1&nbsp;&nbsp;&nbsp;Simplified Build From Source</a></li>
<li><a class="reference internal" href="#or-build-binaries-from-source" id="id37">5.2&nbsp;&nbsp;&nbsp;Or, Build Binaries From Source</a><ul class="auto-toc">
<li><a class="reference internal" href="#install-boost-build" id="id38">5.2.1&nbsp;&nbsp;&nbsp;Install Boost.Build</a></li>
<li><a class="reference internal" href="#identify-your-toolset" id="id39">5.2.2&nbsp;&nbsp;&nbsp;Identify Your Toolset</a></li>
<li><a class="reference internal" href="#select-a-build-directory" id="id40">5.2.3&nbsp;&nbsp;&nbsp;Select a Build Directory</a></li>
<li><a class="reference internal" href="#invoke-b2" id="id41">5.2.4&nbsp;&nbsp;&nbsp;Invoke <tt class="docutils literal">b2</tt></a></li>
</ul>
</li>
<li><a class="reference internal" href="#expected-build-output" id="id42">5.3&nbsp;&nbsp;&nbsp;Expected Build Output</a></li>
<li><a class="reference internal" href="#in-case-of-build-errors" id="id43">5.4&nbsp;&nbsp;&nbsp;In Case of Build Errors</a></li>
</ul>
</li>
<li><a class="reference internal" href="#link-your-program-to-a-boost-library" id="id44">6&nbsp;&nbsp;&nbsp;Link Your Program to a Boost Library</a><ul class="auto-toc">
<li><a class="reference internal" href="#link-from-within-the-visual-studio-ide" id="id45">6.1&nbsp;&nbsp;&nbsp;Link From Within the Visual Studio IDE</a></li>
<li><a class="reference internal" href="#or-link-from-the-command-prompt" id="id46">6.2&nbsp;&nbsp;&nbsp;Or, Link From the Command Prompt</a></li>
<li><a class="reference internal" href="#library-naming" id="id47">6.3&nbsp;&nbsp;&nbsp;Library Naming</a></li>
<li><a class="reference internal" href="#test-your-program" id="id48">6.4&nbsp;&nbsp;&nbsp;Test Your Program</a></li>
</ul>
</li>
<li><a class="reference internal" href="#conclusion-and-further-resources" id="id49">7&nbsp;&nbsp;&nbsp;Conclusion and Further Resources</a></li>
</ul>
</div>
<div class="section" id="get-boost">
<h1><a class="toc-backref" href="#id28">1&nbsp;&nbsp;&nbsp;Get Boost</a></h1>
<p>The most reliable way to get a copy of Boost is to
download <a class="reference external" href="http://www.boost.org/users/history/version_1_66_0.html"><tt class="docutils literal">boost_1_66_0</tt><tt class="docutils literal">.7z</tt></a> or <a class="reference external" href="http://www.boost.org/users/history/version_1_66_0.html"><tt class="docutils literal">boost_1_66_0</tt><tt class="docutils literal">.zip</tt></a> and unpack it to install a complete Boost
distribution.<a class="footnote-reference" href="#zip" id="id2"><sup>1</sup></a></p>
<!-- Copyright David Abrahams 2006. 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) -->
</div>
<div class="section" id="the-boost-distribution">
<h1><a class="toc-backref" href="#id29">2&nbsp;&nbsp;&nbsp;The Boost Distribution</a></h1>
<p>This is a sketch of the resulting directory structure:</p>
<pre class="literal-block">
<strong>boost_1_66_0</strong><strong>\</strong> .................<em>The “boost root directory”</em>
   <strong>index.htm</strong> .........<em>A copy of www.boost.org starts here</em>
   <strong>boost</strong><strong>\</strong> .........................<em>All Boost Header files</em>
   <strong>lib</strong><strong>\</strong> .....................<em>precompiled library binaries</em>
   <strong>libs</strong><strong>\</strong> ............<em>Tests, .cpp</em>s<em>, docs, etc., by library</em>
     <strong>index.html</strong> ........<em>Library documentation starts here</em>
     <strong>algorithm</strong><strong>\</strong>
     <strong>any</strong><strong>\</strong>
     <strong>array</strong><strong>\</strong>
                     <em>…more libraries…</em>
   <strong>status</strong><strong>\</strong> .........................<em>Boost-wide test suite</em>
   <strong>tools</strong><strong>\</strong> ...........<em>Utilities, e.g. Boost.Build, quickbook, bcp</em>
   <strong>more</strong><strong>\</strong> ..........................<em>Policy documents, etc.</em>
   <strong>doc</strong><strong>\</strong> ...............<em>A subset of all Boost library docs</em>
</pre>
<div class="sidebar">
<p class="first sidebar-title">Header Organization</p>
<p class="pre-wrap">The organization of Boost library headers isn't entirely uniform,
but most libraries follow a few patterns:</p>
<ul class="pre-wrap last">
<li><p class="first">Some older libraries and most very small libraries place all
public headers directly into <tt class="docutils literal">boost</tt><tt class="docutils literal">\</tt>.</p>
</li>
<li><p class="first">Most libraries' public headers live in a subdirectory of
<tt class="docutils literal">boost</tt><tt class="docutils literal">\</tt>, named after the library.  For example, you'll find
the Python library's <tt class="docutils literal">def.hpp</tt> header in</p>
<pre class="literal-block">
<tt class="docutils literal">boost</tt><tt class="docutils literal">\</tt><tt class="docutils literal">python</tt><tt class="docutils literal">\</tt><tt class="docutils literal">def.hpp</tt>.
</pre>
</li>
<li><p class="first">Some libraries have an “aggregate header” in <tt class="docutils literal">boost</tt><tt class="docutils literal">\</tt> that
<tt class="docutils literal">#include</tt>s all of the library's other headers.  For
example, <a class="reference external" href="../../libs/python/doc/html/building.html">Boost.Python</a>'s aggregate header is</p>
<pre class="literal-block">
<tt class="docutils literal">boost</tt><tt class="docutils literal">\</tt><tt class="docutils literal">python.hpp</tt>.
</pre>
</li>
<li><p class="first">Most libraries place private headers in a subdirectory called
<tt class="docutils literal">detail</tt><tt class="docutils literal">\</tt>, or <tt class="docutils literal">aux_</tt><tt class="docutils literal">\</tt>.  Don't expect to find
anything you can use in these directories.</p>
</li>
</ul>
</div>
<p>It's important to note the following:</p>
<ol class="arabic" id="boost-root-directory">
<li><p class="first">The path to the <strong>boost root directory</strong> (often <tt class="docutils literal"><span class="pre">C:\Program</span> Files\boost\</tt><tt class="docutils literal">boost_1_66_0</tt>) is
sometimes referred to as <tt class="docutils literal">$BOOST_ROOT</tt> in documentation and
mailing lists .</p>
</li>
<li><p class="first">To compile anything in Boost, you need a directory containing
the <tt class="docutils literal">boost</tt><tt class="docutils literal">\</tt> subdirectory in your <tt class="docutils literal">#include</tt> path.  Specific steps for setting up <tt class="docutils literal">#include</tt>
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">.hpp</tt> extension,
and live in the <tt class="docutils literal">boost</tt><tt class="docutils literal">\</tt> subdirectory of the boost root, your
Boost <tt class="docutils literal">#include</tt> directives will look like:</p>
<pre class="literal-block">
#include &lt;boost/<em>whatever</em>.hpp&gt;
</pre>
<p>or</p>
<pre class="literal-block">
#include &quot;boost/<em>whatever</em>.hpp&quot;
</pre>
<p>depending on your preference regarding the use of angle bracket
includes.  Even Windows users can (and, for
portability reasons, probably should) use forward slashes in
<tt class="docutils literal">#include</tt> directives; your compiler doesn't care.</p>
</li>
<li><p class="first">Don't be distracted by the <tt class="docutils literal">doc</tt><tt class="docutils literal">\</tt> subdirectory; it only
contains a subset of the Boost documentation.  Start with
<tt class="docutils literal">libs</tt><tt class="docutils literal">\</tt><tt class="docutils literal">index.html</tt> if you're looking for the whole enchilada.</p>
</li>
</ol>
<!-- Copyright David Abrahams 2006. 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) -->
</div>
<div class="section" id="header-only-libraries">
<h1><a class="toc-backref" href="#id30">3&nbsp;&nbsp;&nbsp;Header-Only Libraries</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-nothing-to-build admonition">
<p class="first admonition-title">Nothing to Build?</p>
<p class="last">Most Boost libraries are <strong>header-only</strong>: they consist <em>entirely
of header files</em> containing templates and inline functions, and
require no separately-compiled library binaries or special
treatment when linking.</p>
</div>
<!-- .. _separate: -->
<p>The only Boost libraries that <em>must</em> be built separately are:</p>
<ul class="simple">
<li><a class="reference external" href="../../libs/chrono/index.html">Boost.Chrono</a></li>
<li><a class="reference external" href="../../libs/context/index.html">Boost.Context</a></li>
<li><a class="reference external" href="../../libs/filesystem/index.html">Boost.Filesystem</a></li>
<li><a class="reference external" href="../../libs/graph_parallel/index.html">Boost.GraphParallel</a></li>
<li><a class="reference external" href="../../libs/iostreams/index.html">Boost.IOStreams</a></li>
<li><a class="reference external" href="../../libs/locale/index.html">Boost.Locale</a></li>
<li><a class="reference external" href="../../libs/log/index.html">Boost.Log</a> (see <a class="reference external" href="../../libs/log/doc/html/log/installation/config.html">build documentation</a>)</li>
<li><a class="reference external" href="../../libs/mpi/index.html">Boost.MPI</a></li>
<li><a class="reference external" href="../../libs/program_options/index.html">Boost.ProgramOptions</a></li>
<li><a class="reference external" href="../../libs/python/doc/html/building.html">Boost.Python</a> (see the <a class="reference external" href="../../libs/python/doc/html/building.html">Boost.Python build documentation</a>
before building and installing it)</li>
<li><a class="reference external" href="../../libs/regex/index.html">Boost.Regex</a></li>
<li><a class="reference external" href="../../libs/serialization/index.html">Boost.Serialization</a></li>
<li><a class="reference external" href="../../libs/signals/index.html">Boost.Signals</a></li>
<li><a class="reference external" href="../../libs/system/index.html">Boost.System</a></li>
<li><a class="reference external" href="../../libs/thread/index.html">Boost.Thread</a></li>
<li><a class="reference external" href="../../libs/timer/index.html">Boost.Timer</a></li>
<li><a class="reference external" href="../../libs/wave/index.html">Boost.Wave</a></li>
</ul>
<p>A few libraries have optional separately-compiled binaries:</p>
<ul class="simple">
<li><a class="reference external" href="../../libs/date_time/index.html">Boost.DateTime</a> has a binary component that is only needed if
you're using its <tt class="docutils literal">to_string</tt>/<tt class="docutils literal">from_string</tt> or serialization
features, or if you're targeting Visual C++ 6.x or Borland.</li>
<li><a class="reference external" href="../../libs/graph/index.html">Boost.Graph</a> also has a binary component that is only needed if
you intend to <a class="reference external" href="../../libs/graph/doc/read_graphviz.html">parse GraphViz files</a>.</li>
<li><a class="reference external" href="../../libs/math/index.html">Boost.Math</a> has binary components for the TR1 and C99
cmath functions.</li>
<li><a class="reference external" href="../../libs/random/index.html">Boost.Random</a> has a binary component which is only needed if
you're using <tt class="docutils literal">random_device</tt>.</li>
<li><a class="reference external" href="../../libs/test/index.html">Boost.Test</a> can be used in “header-only” or “separately compiled”
mode, although <strong>separate compilation is recommended for serious
use</strong>.</li>
<li><a class="reference external" href="../../libs/exception/index.html">Boost.Exception</a> provides non-intrusive implementation of
exception_ptr for 32-bit _MSC_VER==1310 and _MSC_VER==1400
which requires a separately-compiled binary. This is enabled by
#define BOOST_ENABLE_NON_INTRUSIVE_EXCEPTION_PTR.</li>
</ul>
<!-- Copyright David Abrahams 2006. 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) -->
</div>
<div class="section" id="build-a-simple-program-using-boost">
<h1><a class="toc-backref" href="#id31">4&nbsp;&nbsp;&nbsp;Build a Simple Program Using Boost</a></h1>
<p>To keep things simple, let's start by using a header-only library.
The following program reads a sequence of integers from standard
input, uses Boost.Lambda to multiply each number by three, and
writes them to standard output:</p>
<pre class="literal-block">
#include &lt;boost/lambda/lambda.hpp&gt;
#include &lt;iostream&gt;
#include &lt;iterator&gt;
#include &lt;algorithm&gt;

int main()
{
    using namespace boost::lambda;
    typedef std::istream_iterator&lt;int&gt; in;

    std::for_each(
        in(std::cin), in(), std::cout &lt;&lt; (_1 * 3) &lt;&lt; &quot; &quot; );
}
</pre>
<p>Copy the text of this program into a file called <tt class="docutils literal">example.cpp</tt>.</p>
<div class="note" id="command-line-tool">
<span id="command-prompt"></span><p class="first admonition-title">Note</p>
<p class="last">To build the examples in this guide, you can use an
Integrated Development Environment (IDE) like Visual Studio, or
you can issue commands from the <a class="reference internal" href="#command-prompt">command prompt</a>.  Since every
IDE and compiler has different options and Microsoft's are by
far the dominant compilers on Windows, we only give specific
directions here for Visual Studio 2005 and .NET 2003 IDEs and
their respective command prompt compilers (using the command
prompt is a bit simpler).  If you are using another compiler or
IDE, it should be relatively easy to adapt these instructions to
your environment.</p>
</div>
<div class="small sidebar">
<p class="first sidebar-title">Command Prompt Basics</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 a generic <em>Command Prompt</em>, click the <em>Start</em> menu
button, click <em>Run</em>, type “cmd”, and then click <em>OK</em>.</p>
<p id="current-directory">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> Files\boost\</tt><tt class="docutils literal">boost_1_66_0</tt>
</pre>
<p class="last">Long commands can be continued across several lines by typing a
caret (<tt class="docutils literal">^</tt>) at the end of all but the last line.  Some examples
on this page use that technique to save horizontal space.</p>
</div>
<div class="section" id="build-from-the-visual-studio-ide">
<span id="vs-header-only"></span><h2><a class="toc-backref" href="#id32">4.1&nbsp;&nbsp;&nbsp;Build From the Visual Studio IDE</a></h2>
<ul>
<li><p class="first">From Visual Studio's <em>File</em> menu, select <em>New</em> &gt; <em>Project…</em></p>
</li>
<li><p class="first">In the left-hand pane of the resulting <em>New Project</em> dialog,
select <em>Visual C++</em> &gt; <em>Win32</em>.</p>
</li>
<li><p class="first">In the right-hand pane, select <em>Win32 Console Application</em>
(VS8.0) or <em>Win32 Console Project</em> (VS7.1).</p>
</li>
<li><p class="first">In the <em>name</em> field, enter “example”</p>
</li>
<li><p class="first">Right-click <strong>example</strong> in the <em>Solution Explorer</em> pane and
select <em>Properties</em> from the resulting pop-up menu</p>
</li>
<li><p class="first">In <em>Configuration Properties</em> &gt; <em>C/C++</em> &gt; <em>General</em> &gt; <em>Additional Include
Directories</em>, enter the path to the Boost root directory, for example</p>
<blockquote>
<p><tt class="docutils literal"><span class="pre">C:\Program</span> Files\boost\</tt><tt class="docutils literal">boost_1_66_0</tt></p>
</blockquote>
</li>
<li><p class="first">In <em>Configuration Properties</em> &gt; <em>C/C++</em> &gt; <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"><sup>2</sup></a></p>
</li>
<li><p class="first">Replace the contents of the <tt class="docutils literal">example.cpp</tt> generated by the IDE
with the example code above.</p>
</li>
<li><p class="first">From the <em>Build</em> menu, select <em>Build Solution</em>.</p>
</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 &quot;Z&quot;, followed by the
Return key.</p>
<p><a class="reference internal" href="#errors-and-warnings"><em>skip to the next step</em></a></p>
</div>
<div class="section" id="or-build-from-the-command-prompt">
<h2><a class="toc-backref" href="#id33">4.2&nbsp;&nbsp;&nbsp;Or, Build From the Command Prompt</a></h2>
<p>From your computer's <em>Start</em> menu, if you are a Visual
Studio 2005 user, select</p>
<blockquote>
<em>All Programs</em> &gt; <em>Microsoft Visual Studio 2005</em>
&gt; <em>Visual Studio Tools</em> &gt; <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> &gt; <em>Microsoft Visual Studio .NET 2003</em>
&gt; <em>Visual Studio .NET Tools</em> &gt; <em>Visual Studio .NET 2003 Command Prompt</em></blockquote>
<p>to bring up a special <a class="reference internal" href="#command-prompt">command prompt</a> window set up for the
Visual Studio compiler.  In that window, set the <a class="reference internal" href="#current-directory">current
directory</a> to a suitable location for creating some temporary
files and type the following command followed by the Return key:</p>
<pre class="literal-block">
cl /EHsc /I <em>path\to\</em><tt class="docutils literal">boost_1_66_0</tt> <em>path</em>\<em>to</em>\example.cpp
</pre>
<p>To test the result, type:</p>
<pre class="literal-block">
echo 1 2 3 | example
</pre>
<!-- Copyright David Abrahams 2006. 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) -->
</div>
<div class="section" id="errors-and-warnings">
<h2><a class="toc-backref" href="#id34">4.3&nbsp;&nbsp;&nbsp;Errors and Warnings</a></h2>
<p>Don't be alarmed if you see compiler warnings originating in Boost
headers.  We try to eliminate them, but doing so isn't always
practical.<a class="footnote-reference" href="#warnings" id="id8"><sup>4</sup></a> <strong>Errors are another matter</strong>.  If you're
seeing compilation errors at this point in the tutorial, check to
be sure you've copied the <a class="reference internal" href="#build-a-simple-program-using-boost">example program</a> correctly and that you've
correctly identified the <a class="reference internal" href="#boost-root-directory">Boost root directory</a>.</p>
<!-- Copyright David Abrahams 2006. 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) -->
</div>
</div>
<div class="section" id="prepare-to-use-a-boost-library-binary">
<h1><a class="toc-backref" href="#id35">5&nbsp;&nbsp;&nbsp;Prepare to Use a Boost Library Binary</a></h1>
<p>If you want to use any of the separately-compiled Boost libraries,
you'll need to acquire library binaries.</p>
<div class="section" id="simplified-build-from-source">
<h2><a class="toc-backref" href="#id36">5.1&nbsp;&nbsp;&nbsp;Simplified Build From Source</a></h2>
<p>If you wish to build from source with Visual C++, you can use a
simple build procedure described in this section. Open the command prompt
and change your current directory to the Boost root directory. Then, type
the following commands:</p>
<pre class="literal-block">
bootstrap
.\b2
</pre>
<p>The first command prepares the Boost.Build system for use. The second
command invokes Boost.Build to build the separately-compiled Boost
libraries. Please consult the <a class="reference external" href="http://www.boost.org/build/doc/html/bbv2/overview/invocation.html">Boost.Build documentation</a> for a list
of allowed options.</p>
</div>
<div class="section" id="or-build-binaries-from-source">
<h2><a class="toc-backref" href="#id37">5.2&nbsp;&nbsp;&nbsp;Or, Build Binaries From Source</a></h2>
<p>If you're using an earlier version of Visual C++, or a compiler
from another vendor, you'll need to use <a class="reference external" href="../../tools/build/index.html">Boost.Build</a> to create your
own binaries.</p>
<!-- Copyright David Abrahams 2006. 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) -->
<div class="section" id="install-boost-build">
<h3><a class="toc-backref" href="#id38">5.2.1&nbsp;&nbsp;&nbsp;Install Boost.Build</a></h3>
<p><a class="reference external" href="../../tools/build/index.html">Boost.Build</a> is a text-based system for developing, testing, and
installing software. First, you'll need to build and
install it. To do this:</p>
<ol class="arabic simple">
<li>Go to the directory <tt class="docutils literal">tools</tt><tt class="docutils literal">\</tt><tt class="docutils literal">build</tt><tt class="docutils literal">\</tt>.</li>
<li>Run <tt class="docutils literal">bootstrap.bat</tt></li>
<li>Run <tt class="docutils literal">b2 install <span class="pre">--prefix=</span></tt><em>PREFIX</em> where <em>PREFIX</em> is
the directory where you want Boost.Build to be installed</li>
<li>Add <em>PREFIX</em><tt class="docutils literal">\</tt><tt class="docutils literal">bin</tt> to your PATH environment variable.</li>
</ol>
</div>
<div class="section" id="identify-your-toolset">
<span id="toolset-name"></span><span id="toolset"></span><h3><a class="toc-backref" href="#id39">5.2.2&nbsp;&nbsp;&nbsp;Identify Your Toolset</a></h3>
<p>First, find the toolset corresponding to your compiler in the
following table (an up-to-date list is always available <a class="reference external" href="http://www.boost.org/build/doc/html/bbv2/reference/tools.html">in the
Boost.Build documentation</a>).</p>
<div class="note">
<p class="first admonition-title">Note</p>
<p class="last">If you previously chose a toolset for the purposes of
<a class="reference external" href="../../doc/html/bbv2/installation.html">building b2</a>, you should assume it won't work and instead
choose newly from the table below.</p>
</div>
<table border="1" class="docutils">
<colgroup>
<col width="12%" />
<col width="22%" />
<col width="66%" />
</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">acc</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">borland</tt></td>
<td>Borland</td>
<td>&nbsp;</td>
</tr>
<tr><td><tt class="docutils literal">como</tt></td>
<td>Comeau Computing</td>
<td>Using this toolset may require <a class="reference external" href="../../tools/build/index.html">configuring</a> another
toolset to act as its backend.</td>
</tr>
<tr><td><tt class="docutils literal">darwin</tt></td>
<td>Apple Computer</td>
<td>Apple's version of the GCC toolchain with support for
Darwin and MacOS X features such as frameworks.</td>
</tr>
<tr><td><tt class="docutils literal">gcc</tt></td>
<td>The Gnu Project</td>
<td>Includes support for Cygwin and MinGW compilers.</td>
</tr>
<tr><td><tt class="docutils literal">hp_cxx</tt></td>
<td>Hewlett Packard</td>
<td>Targeted at the Tru64 operating system.</td>
</tr>
<tr><td><tt class="docutils literal">intel</tt></td>
<td>Intel</td>
<td>&nbsp;</td>
</tr>
<tr><td><tt class="docutils literal">msvc</tt></td>
<td>Microsoft</td>
<td>&nbsp;</td>
</tr>
<tr><td><tt class="docutils literal">sun</tt></td>
<td>Oracle</td>
<td>Only very recent versions are known to work well with
Boost.  Note that the Oracle/Sun compiler has a large number
of options which effect binary compatibility: it is vital
that the libraries are built with the same options that your
appliction will use. In particular be aware that the default
standard library may not work well with Boost, <em>unless you
are building for C++11</em>. The particular compiler options you
need can be injected with the b2 command line options
<tt class="docutils literal"><span class="pre">cxxflags=``and</span> ``linkflags=</tt>.  For example to build with
the Apache standard library in C++03 mode use
<tt class="docutils literal">b2 <span class="pre">cxxflags=-library=stdcxx4</span> <span class="pre">linkflags=-library=stdcxx4</span></tt>.</td>
</tr>
<tr><td><tt class="docutils literal">vacpp</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 append the version number to the toolset name, preceded by
a hyphen, e.g. <tt class="docutils literal"><span class="pre">intel-9.0</span></tt> or
<tt class="docutils literal"><span class="pre">borland-5.4.3</span></tt>. <strong>On Windows, append a version
number even if you only have one version installed</strong> (unless you
are using the msvc or gcc toolsets, which have special version
detection code) or <a class="reference internal" href="#auto-linking">auto-linking</a> will fail.</p>
</div>
<div class="section" id="select-a-build-directory">
<span id="id13"></span><span id="build-directory"></span><h3><a class="toc-backref" href="#id40">5.2.3&nbsp;&nbsp;&nbsp;Select a Build Directory</a></h3>
<p><a class="reference external" 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">bin.v2/</tt> subdirectory for that
purpose in your current working directory.</p>
</div>
<div class="section" id="invoke-b2">
<h3><a class="toc-backref" href="#id41">5.2.4&nbsp;&nbsp;&nbsp;Invoke <tt class="docutils literal">b2</tt></a></h3>
<p>Change your current directory to the Boost root directory and
invoke <tt class="docutils literal">b2</tt> as follows:</p>
<pre class="literal-block">
b2 <strong>--build-dir=</strong><a class="reference internal" href="#id13"><em>build-directory</em></a> <strong>toolset=</strong><a class="reference internal" href="#toolset-name"><em>toolset-name</em></a> <strong>--build-type=complete</strong> stage
</pre>
<p>For a complete description of these and other invocation options,
please see the <a class="reference external" href="http://www.boost.org/build/doc/html/bbv2/overview/invocation.html">Boost.Build documentation</a>.</p>
<p>For example, your session might look like this:<a class="footnote-reference" href="#continuation" id="id15"><sup>3</sup></a></p>
<pre class="literal-block">
C:\WINDOWS&gt; cd <tt class="docutils literal"><span class="pre">C:\Program</span> Files\boost\</tt><tt class="docutils literal">boost_1_66_0</tt>
<tt class="docutils literal"><span class="pre">C:\Program</span> Files\boost\</tt><tt class="docutils literal">boost_1_66_0</tt>&gt; b2 <strong>^</strong>
More? <strong>--build-dir=</strong>&quot;C:\Documents and Settings\dave\build-boost&quot; <strong>^</strong>
More? <strong>--build-type=complete</strong> <strong>msvc</strong> stage
</pre>
<p>Be sure to read <a class="reference internal" href="#continuation">this note</a> about the appearance of <tt class="docutils literal">^</tt>,
<tt class="docutils literal">More?</tt> and quotation marks (<tt class="docutils literal">&quot;</tt>) in that line.</p>
<p>The option “<strong>--build-type=complete</strong>” causes Boost.Build to build
all supported variants of the libraries.  For instructions on how to
build only specific variants, please ask on the <a class="reference external" href="http://www.boost.org/more/mailing_lists.htm#jamboost">Boost.Build mailing
list</a>.</p>
<!-- Copyright David Abrahams 2006. 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) -->
<p>Building the special <tt class="docutils literal">stage</tt> target places Boost
library binaries in the <tt class="docutils literal">stage</tt><tt class="docutils literal">\</tt><tt class="docutils literal">lib</tt><tt class="docutils literal">\</tt> subdirectory of
the Boost tree.  To use a different directory pass the
<tt class="docutils literal"><span class="pre">--stagedir=</span></tt><em>directory</em> option to <tt class="docutils literal">b2</tt>.</p>
<div class="note">
<p class="first admonition-title">Note</p>
<p class="last"><tt class="docutils literal">b2</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>For a description of other options you can pass when invoking
<tt class="docutils literal">b2</tt>, type:</p>
<pre class="literal-block">
b2 --help
</pre>
<p>In particular, to limit the amount of time spent building, you may
be interested in:</p>
<ul class="simple">
<li>reviewing the list of library names with <tt class="docutils literal"><span class="pre">--show-libraries</span></tt></li>
<li>limiting which libraries get built with the <tt class="docutils literal"><span class="pre">--with-</span></tt><em>library-name</em> or <tt class="docutils literal"><span class="pre">--without-</span></tt><em>library-name</em> options</li>
<li>choosing a specific build variant by adding <tt class="docutils literal">release</tt> or
<tt class="docutils literal">debug</tt> to the command line.</li>
</ul>
<div class="note">
<p class="first admonition-title">Note</p>
<p class="last">Boost.Build can produce a great deal of output, which can
make it easy to miss problems.  If you want to make sure
everything is went well, you might redirect the output into a
file by appending “<tt class="docutils literal">&gt;build.log <span class="pre">2&gt;&amp;1</span></tt>” to your command line.</p>
</div>
</div>
</div>
<div class="section" id="expected-build-output">
<h2><a class="toc-backref" href="#id42">5.3&nbsp;&nbsp;&nbsp;Expected Build Output</a></h2>
<p>During the process of building Boost libraries, you can expect to
see some messages printed on the console.  These may include</p>
<ul>
<li><p class="first">Notices about Boost library configuration—for example, the Regex
library outputs a message about ICU when built without Unicode
support, and the Python library may be skipped without error (but
with a notice) if you don't have Python installed.</p>
</li>
<li><p class="first">Messages from the build tool that report the number of targets
that were built or skipped.  Don't be surprised if those numbers
don't make any sense to you; there are many targets per library.</p>
</li>
<li><p class="first">Build action messages describing what the tool is doing, which
look something like:</p>
<pre class="literal-block">
<em>toolset-name</em>.c++ <em>long</em>/<em>path</em>/<em>to</em>/<em>file</em>/<em>being</em>/<em>built</em>
</pre>
</li>
<li><p class="first">Compiler warnings.</p>
</li>
</ul>
</div>
<div class="section" id="in-case-of-build-errors">
<h2><a class="toc-backref" href="#id43">5.4&nbsp;&nbsp;&nbsp;In Case of Build Errors</a></h2>
<p>The only error messages you see when building Boost—if any—should
be related to the IOStreams library's support of zip and bzip2
formats as described <a class="reference external" href="../../libs/iostreams/doc/installation.html">here</a>.  Install the relevant development
packages for libz and libbz2 if you need those features.  Other
errors when building Boost libraries are cause for concern.</p>
<p>If it seems like the build system can't find your compiler and/or
linker, consider setting up a <tt class="docutils literal"><span class="pre">user-config.jam</span></tt> file as described
<a class="reference external" href="http://www.boost.org/build/doc/html/bbv2/overview/configuration.html">here</a>.  If that isn't your problem or the <tt class="docutils literal"><span class="pre">user-config.jam</span></tt> file
doesn't work for you, please address questions about configuring Boost
for your compiler to the <a class="reference external" href="http://www.boost.org/more/mailing_lists.htm#jamboost">Boost.Build mailing list</a>.</p>
<span class="target" id="auto-linking"></span><!-- Copyright David Abrahams 2006. 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) -->
</div>
</div>
<div class="section" id="link-your-program-to-a-boost-library">
<h1><a class="toc-backref" href="#id44">6&nbsp;&nbsp;&nbsp;Link Your Program to 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 external" href="../../libs/regex/index.html">Boost.Regex</a> library, which has a
separately-compiled binary component.</p>
<pre class="literal-block">
#include &lt;boost/regex.hpp&gt;
#include &lt;iostream&gt;
#include &lt;string&gt;

int main()
{
    std::string line;
    boost::regex pat( &quot;^Subject: (Re: |Aw: )*(.*)&quot; );

    while (std::cin)
    {
        std::getline(std::cin, line);
        boost::smatch matches;
        if (boost::regex_match(line, matches, pat))
            std::cout &lt;&lt; matches[2] &lt;&lt; std::endl;
    }
}
</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="admonition-auto-linking admonition">
<p class="first admonition-title">Auto-Linking</p>
<p>Most Windows compilers and linkers have so-called “auto-linking
support,” which eliminates 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>
<p class="last">The GCC toolchains (Cygwin and MinGW) are notable exceptions;
GCC users should refer to the <a class="reference external" href="unix-variants.html#link-your-program-to-a-boost-library">linking instructions for Unix
variant OSes</a> for the appropriate command-line options to use.</p>
</div>
<div class="section" id="link-from-within-the-visual-studio-ide">
<h2><a class="toc-backref" href="#id45">6.1&nbsp;&nbsp;&nbsp;Link From Within the Visual Studio IDE</a></h2>
<p>Starting with the <a class="reference internal" 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> &gt; <em>Linker</em> &gt; <em>Additional Library
Directories</em>, enter the path to the Boost binaries,
e.g. <tt class="docutils literal"><span class="pre">C:\Program</span> Files\boost\</tt><tt class="docutils literal">boost_1_66_0</tt><tt class="docutils literal">\lib\</tt>.</li>
<li>From the <em>Build</em> menu, select <em>Build Solution</em>.</li>
</ol>
<p><a class="reference internal" href="#test-your-program"><em>skip to the next step</em></a></p>
</div>
<div class="section" id="or-link-from-the-command-prompt">
<h2><a class="toc-backref" href="#id46">6.2&nbsp;&nbsp;&nbsp;Or, Link From the Command Prompt</a></h2>
<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> Files\boost\</tt><tt class="docutils literal">boost_1_66_0</tt><tt class="docutils literal">\lib</tt>:</p>
<pre class="literal-block">
cl /EHsc /I <em>path\to\</em><tt class="docutils literal">boost_1_66_0</tt> example.cpp   <strong>^</strong>
     <strong>/link /LIBPATH:</strong><strong>C:\Program Files\boost\</strong><strong>boost_1_66_0</strong><strong>\lib</strong>
</pre>
</div>
<div class="section" id="library-naming">
<h2><a class="toc-backref" href="#id47">6.3&nbsp;&nbsp;&nbsp;Library Naming</a></h2>
<div class="note">
<p class="first admonition-title">Note</p>
<p>If, like Visual C++, your compiler supports auto-linking,
you can probably <a class="reference internal" href="#test-your-program"><em>skip to the next step</em></a>.</p>
<blockquote class="last">
</blockquote>
</div>
<!-- Copyright David Abrahams 2006. 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) -->
<p>In order to choose the right binary for your build configuration
you need to know how Boost binaries are named.  Each library
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-vc71-mt-d-x86-1_34.lib</span></tt> can be broken down into the
following elements:</p>
<dl class="docutils">
<dt><tt class="docutils literal">lib</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">lib</tt> prefix; import libraries and DLLs do
not.<a class="footnote-reference" href="#distinct" id="id23"><sup>5</sup></a></dd>
<dt><tt class="docutils literal">boost_regex</tt></dt>
<dd><em>Library name</em>: all boost library filenames begin with <tt class="docutils literal">boost_</tt>.</dd>
<dt><tt class="docutils literal"><span class="pre">-vc71</span></tt></dt>
<dd><em>Toolset tag</em>: identifies the <a class="reference internal" href="#toolset">toolset</a> and version used to build
the binary.</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>
<blockquote>
<table border="1" class="docutils">
<colgroup>
<col width="5%" />
<col width="75%" />
<col width="20%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">Key</th>
<th class="head">Use this library when:</th>
<th class="head">Boost.Build option</th>
</tr>
</thead>
<tbody valign="top">
<tr><td><tt class="docutils literal">s</tt></td>
<td>linking statically to the C++ standard library and compiler runtime support
libraries.</td>
<td>runtime-link=static</td>
</tr>
<tr><td><tt class="docutils literal">g</tt></td>
<td>using debug versions of the standard and runtime support libraries.</td>
<td>runtime-debugging=on</td>
</tr>
<tr><td><tt class="docutils literal">y</tt></td>
<td>using a special <a class="reference external" href="../../libs/python/doc/html/building/python_debugging_builds.html">debug build of Python</a>.</td>
<td>python-debugging=on</td>
</tr>
<tr><td><tt class="docutils literal">d</tt></td>
<td>building a debug version of your code.<a class="footnote-reference" href="#debug-abi" id="id24"><sup>6</sup></a></td>
<td>variant=debug</td>
</tr>
<tr><td><tt class="docutils literal">p</tt></td>
<td>using the STLPort standard library rather than the default one supplied with
your compiler.</td>
<td>stdlib=stlport</td>
</tr>
</tbody>
</table>
</blockquote>
<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,
the tag would be: <tt class="docutils literal"><span class="pre">-sgdp</span></tt>.  If none of the above apply, the
ABI tag is ommitted.</p>
</dd>
<dt><tt class="docutils literal"><span class="pre">-x86</span></tt></dt>
<dd><p class="first"><em>Architecture and address model tag</em>: in the first letter, encodes the architecture as follows:</p>
<blockquote>
<table border="1" class="docutils">
<colgroup>
<col width="11%" />
<col width="41%" />
<col width="48%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">Key</th>
<th class="head">Architecture</th>
<th class="head">Boost.Build option</th>
</tr>
</thead>
<tbody valign="top">
<tr><td><tt class="docutils literal">x</tt></td>
<td>x86-32, x86-64</td>
<td>architecture=x86</td>
</tr>
<tr><td><tt class="docutils literal">a</tt></td>
<td>ARM</td>
<td>architecture=arm</td>
</tr>
<tr><td><tt class="docutils literal">i</tt></td>
<td>IA-64</td>
<td>architecture=ia64</td>
</tr>
<tr><td><tt class="docutils literal">s</tt></td>
<td>Sparc</td>
<td>architecture=sparc</td>
</tr>
<tr><td><tt class="docutils literal">m</tt></td>
<td>MIPS/SGI</td>
<td>architecture=mips*</td>
</tr>
<tr><td><tt class="docutils literal">p</tt></td>
<td>RS/6000 &amp; PowerPC</td>
<td>architecture=power</td>
</tr>
</tbody>
</table>
</blockquote>
<p>The two digits following the letter encode the address model as follows:</p>
<blockquote class="last">
<table border="1" class="docutils">
<colgroup>
<col width="13%" />
<col width="40%" />
<col width="47%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">Key</th>
<th class="head">Address model</th>
<th class="head">Boost.Build option</th>
</tr>
</thead>
<tbody valign="top">
<tr><td><tt class="docutils literal">32</tt></td>
<td>32 bit</td>
<td>address-model=32</td>
</tr>
<tr><td><tt class="docutils literal">64</tt></td>
<td>64 bit</td>
<td>address-model=64</td>
</tr>
</tbody>
</table>
</blockquote>
</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. For example, version 1.31.1 would be
tagged as &quot;-1_31_1&quot;.</dd>
<dt><tt class="docutils literal">.lib</tt></dt>
<dd><em>Extension</em>: determined according to the operating system's usual
convention.  On most unix-style platforms the extensions are
<tt class="docutils literal">.a</tt> and <tt class="docutils literal">.so</tt> for static libraries (archives) and shared
libraries, respectively.  On Windows, <tt class="docutils literal">.dll</tt> indicates a shared
library and <tt class="docutils literal">.lib</tt> indicates a
static or import library.  Where supported by toolsets on unix
variants, a full version extension is added (e.g. &quot;.so.1.34&quot;) and
a symbolic link to the library file, named without the trailing
version number, will also be created.</dd>
</dl>
<!-- .. _Boost.Build toolset names: toolset-name_ -->
<!-- Copyright David Abrahams 2006. 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) -->
</div>
<div class="section" id="test-your-program">
<h2><a class="toc-backref" href="#id48">6.4&nbsp;&nbsp;&nbsp;Test Your Program</a></h2>
<p>To test our subject extraction, we'll filter the following text
file.  Copy it out of your browser and save it as <tt class="docutils literal">jayne.txt</tt>:</p>
<pre class="literal-block">
To: George Shmidlap
From: Rita Marlowe
Subject: Will Success Spoil Rock Hunter?
---
See subject.
</pre>
<p>Now, in a <a class="reference internal" href="#command-prompt">command prompt</a> window, type:</p>
<pre class="literal-block">
<em>path</em>\<em>to</em>\<em>compiled</em>\example &lt; <em>path</em>\<em>to</em>\jayne.txt
</pre>
<p>The program should respond with the email subject, “Will Success
Spoil Rock Hunter?”</p>
<!-- Copyright David Abrahams 2006. 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) -->
</div>
</div>
<div class="section" id="conclusion-and-further-resources">
<h1><a class="toc-backref" href="#id49">7&nbsp;&nbsp;&nbsp;Conclusion and Further Resources</a></h1>
<p>This concludes your introduction to Boost and to integrating it
with your programs.  As you start using Boost in earnest, there are
surely a few additional points you'll wish we had covered.  One day
we may have a “Book 2 in the Getting Started series” that addresses
them.  Until then, we suggest you pursue the following resources.
If you can't find what you need, or there's anything we can do to
make this document clearer, please post it to the <a class="reference external" href="http://www.boost.org/more/mailing_lists.htm#users">Boost Users'
mailing list</a>.</p>
<ul class="simple">
<li><a class="reference external" href="../../tools/build/index.html">Boost.Build reference manual</a></li>
<li><a class="reference external" href="http://www.boost.org/more/mailing_lists.htm#users">Boost Users' mailing list</a></li>
<li><a class="reference external" href="http://www.boost.org/more/mailing_lists.htm#jamboost">Boost.Build mailing list</a></li>
<li><a class="reference external" href="../../libs/index.html">Index of all Boost library documentation</a></li>
</ul>
<div class="admonition-onward admonition">
<p class="first admonition-title">Onward</p>
<blockquote class="epigraph last">
<p>Good luck, and have fun!</p>
<p class="attribution">&mdash;the Boost Developers</p>
</blockquote>
</div>
<hr class="docutils" />
<table class="docutils footnote" frame="void" id="zip" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id2">[1]</a></td><td>We recommend
downloading <a class="reference external" href="http://www.boost.org/users/history/version_1_66_0.html"><tt class="docutils literal">boost_1_66_0</tt><tt class="docutils literal">.7z</tt></a> and using <a class="reference external" href="http://www.7-zip.org">7-Zip</a> to decompress
it.  We no longer recommend .zip files for Boost because they are twice
as large as the equivalent .7z files.  We don't recommend using Windows'
built-in decompression as it can be painfully slow for large archives.</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">[2]</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="continuation" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id15">[3]</a></td><td><p class="first">In this example, the caret character <tt class="docutils literal">^</tt> is a
way of continuing the command on multiple lines, and must be the
<strong>final character</strong> used on the line to be continued (i.e. do
not follow it with spaces).  The command prompt responds with
<tt class="docutils literal">More?</tt> to prompt for more input.  Feel free to omit the
carets and subsequent newlines; we used them so the example
would fit on a page of reasonable width.</p>
<p>The command prompt treats each bit of whitespace in the command
as an argument separator.  That means quotation marks (<tt class="docutils literal">&quot;</tt>)
are required to keep text together whenever a single
command-line argument contains spaces, as in</p>
<pre class="literal-block">
--build-dir=<span class="raw-html"><strong style="background-color:#B4FFB4">"</strong></span>C:\Documents<span class="raw-html"><strong style="color:#B4B4B4; background-color:#B4FFB4">_</strong></span>and<span class="raw-html"><strong style="color:#B4B4B4; background-color:#B4FFB4">_</strong></span>Settings\dave\build-boost<span class="raw-html"><strong style="background-color:#B4FFB4">"</strong></span>
</pre>
<p>Also, for example, you can't add spaces around the <tt class="docutils literal">=</tt> sign as in</p>
<pre class="last literal-block">
--build-dir<span class="raw-html"><strong style="color:#B4B4B4; background-color:#FFB4B4">_</strong></span>=<span class="raw-html"><strong style="color:#B4B4B4; background-color:#FFB4B4">_</strong></span>&quot;C:\Documents and Settings\dave\build-boost&quot;
</pre>
</td></tr>
</tbody>
</table>
<!-- Copyright David Abrahams 2006. 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) -->
<table class="docutils footnote" frame="void" id="warnings" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id8">[4]</a></td><td>Remember that warnings are specific to each compiler
implementation.  The developer of a given Boost library might
not have access to your compiler.  Also, some warnings are
extremely difficult to eliminate in generic code, to the point
where it's not worth the trouble.  Finally, some compilers don't
have any source code mechanism for suppressing warnings.</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="#id23">[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="#id24">[6]</a></td><td>These libraries were compiled without optimization
or inlining, with full debug symbols enabled, and without
<tt class="docutils literal">NDEBUG</tt> <tt class="docutils literal">#define</tt>d.  Although 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>
<!-- Copyright David Abrahams 2006. 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) -->
<!-- This file contains all the definitions that need to be updated -->
<!-- for each new release of Boost. -->
<!-- Copyright David Abrahams 2006. 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) -->
<!-- Copyright David Abrahams 2006. 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) -->
<!-- Copyright David Abrahams 2006. 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) -->
</div>
</div>
</body>
</html>