1 <?xml version=
"1.0" encoding=
"UTF-8" standalone=
"no"?>
2 <!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"><head><meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8" /><title>Chapter
3. Using
</title><meta name=
"generator" content=
"DocBook XSL Stylesheets Vsnapshot" /><meta name=
"keywords" content=
"ISO C++, library" /><meta name=
"keywords" content=
"ISO C++, runtime, library" /><link rel=
"home" href=
"../index.html" title=
"The GNU C++ Library" /><link rel=
"up" href=
"intro.html" title=
"Part I. Introduction" /><link rel=
"prev" href=
"make.html" title=
"Make" /><link rel=
"next" href=
"using_headers.html" title=
"Headers" /></head><body><div class=
"navheader"><table width=
"100%" summary=
"Navigation header"><tr><th colspan=
"3" align=
"center">Chapter
3. Using
</th></tr><tr><td width=
"20%" align=
"left"><a accesskey=
"p" href=
"make.html">Prev
</a> </td><th width=
"60%" align=
"center">Part I.
5 </th><td width=
"20%" align=
"right"> <a accesskey=
"n" href=
"using_headers.html">Next
</a></td></tr></table><hr /></div><div class=
"chapter"><div class=
"titlepage"><div><div><h2 class=
"title"><a id=
"manual.intro.using"></a>Chapter
3. Using
</h2></div></div></div><div class=
"toc"><p><strong>Table of Contents
</strong></p><dl class=
"toc"><dt><span class=
"section"><a href=
"using.html#manual.intro.using.flags">Command Options
</a></span></dt><dt><span class=
"section"><a href=
"using_headers.html">Headers
</a></span></dt><dd><dl><dt><span class=
"section"><a href=
"using_headers.html#manual.intro.using.headers.all">Header Files
</a></span></dt><dt><span class=
"section"><a href=
"using_headers.html#manual.intro.using.headers.mixing">Mixing Headers
</a></span></dt><dt><span class=
"section"><a href=
"using_headers.html#manual.intro.using.headers.cheaders">The C Headers and
<code class=
"code">namespace std
</code></a></span></dt><dt><span class=
"section"><a href=
"using_headers.html#manual.intro.using.headers.pre">Precompiled Headers
</a></span></dt></dl></dd><dt><span class=
"section"><a href=
"using_macros.html">Macros
</a></span></dt><dt><span class=
"section"><a href=
"using_dual_abi.html">Dual ABI
</a></span></dt><dd><dl><dt><span class=
"section"><a href=
"using_dual_abi.html#manual.intro.using.abi.trouble">Troubleshooting
</a></span></dt></dl></dd><dt><span class=
"section"><a href=
"using_namespaces.html">Namespaces
</a></span></dt><dd><dl><dt><span class=
"section"><a href=
"using_namespaces.html#manual.intro.using.namespaces.all">Available Namespaces
</a></span></dt><dt><span class=
"section"><a href=
"using_namespaces.html#manual.intro.using.namespaces.std">namespace std
</a></span></dt><dt><span class=
"section"><a href=
"using_namespaces.html#manual.intro.using.namespaces.comp">Using Namespace Composition
</a></span></dt></dl></dd><dt><span class=
"section"><a href=
"using_dynamic_or_shared.html">Linking
</a></span></dt><dd><dl><dt><span class=
"section"><a href=
"using_dynamic_or_shared.html#manual.intro.using.linkage.freestanding">Almost Nothing
</a></span></dt><dt><span class=
"section"><a href=
"using_dynamic_or_shared.html#manual.intro.using.linkage.dynamic">Finding Dynamic or Shared Libraries
</a></span></dt><dt><span class=
"section"><a href=
"using_dynamic_or_shared.html#manual.intro.using.linkage.experimental">Experimental Library Extensions
</a></span></dt></dl></dd><dt><span class=
"section"><a href=
"using_concurrency.html">Concurrency
</a></span></dt><dd><dl><dt><span class=
"section"><a href=
"using_concurrency.html#manual.intro.using.concurrency.prereq">Prerequisites
</a></span></dt><dt><span class=
"section"><a href=
"using_concurrency.html#manual.intro.using.concurrency.thread_safety">Thread Safety
</a></span></dt><dt><span class=
"section"><a href=
"using_concurrency.html#manual.intro.using.concurrency.atomics">Atomics
</a></span></dt><dt><span class=
"section"><a href=
"using_concurrency.html#manual.intro.using.concurrency.io">IO
</a></span></dt><dd><dl><dt><span class=
"section"><a href=
"using_concurrency.html#concurrency.io.structure">Structure
</a></span></dt><dt><span class=
"section"><a href=
"using_concurrency.html#concurrency.io.defaults">Defaults
</a></span></dt><dt><span class=
"section"><a href=
"using_concurrency.html#concurrency.io.future">Future
</a></span></dt><dt><span class=
"section"><a href=
"using_concurrency.html#concurrency.io.alt">Alternatives
</a></span></dt></dl></dd><dt><span class=
"section"><a href=
"using_concurrency.html#manual.intro.using.concurrency.containers">Containers
</a></span></dt></dl></dd><dt><span class=
"section"><a href=
"using_exceptions.html">Exceptions
</a></span></dt><dd><dl><dt><span class=
"section"><a href=
"using_exceptions.html#intro.using.exception.safety">Exception Safety
</a></span></dt><dt><span class=
"section"><a href=
"using_exceptions.html#intro.using.exception.propagating">Exception Neutrality
</a></span></dt><dt><span class=
"section"><a href=
"using_exceptions.html#intro.using.exception.no">Doing without
</a></span></dt><dt><span class=
"section"><a href=
"using_exceptions.html#intro.using.exception.compat">Compatibility
</a></span></dt><dd><dl><dt><span class=
"section"><a href=
"using_exceptions.html#using.exception.compat.c">With
<code class=
"literal">C
</code></a></span></dt><dt><span class=
"section"><a href=
"using_exceptions.html#using.exception.compat.posix">With
<code class=
"literal">POSIX
</code> thread cancellation
</a></span></dt></dl></dd></dl></dd><dt><span class=
"section"><a href=
"debug.html">Debugging Support
</a></span></dt><dd><dl><dt><span class=
"section"><a href=
"debug.html#debug.compiler">Using
<span class=
"command"><strong>g++
</strong></span></a></span></dt><dt><span class=
"section"><a href=
"debug.html#debug.req">Debug Versions of Library Binary Files
</a></span></dt><dt><span class=
"section"><a href=
"debug.html#debug.memory">Memory Leak Hunting
</a></span></dt><dt><span class=
"section"><a href=
"debug.html#debug.races">Data Race Hunting
</a></span></dt><dt><span class=
"section"><a href=
"debug.html#debug.gdb">Using
<span class=
"command"><strong>gdb
</strong></span></a></span></dt><dt><span class=
"section"><a href=
"debug.html#debug.exceptions">Tracking uncaught exceptions
</a></span></dt><dt><span class=
"section"><a href=
"debug.html#debug.debug_mode">Debug Mode
</a></span></dt><dt><span class=
"section"><a href=
"debug.html#debug.compile_time_checks">Compile Time Checking
</a></span></dt><dt><span class=
"section"><a href=
"debug.html#debug.profile_mode">Profile-based Performance Analysis
</a></span></dt></dl></dd></dl></div><div class=
"section"><div class=
"titlepage"><div><div><h2 class=
"title" style=
"clear: both"><a id=
"manual.intro.using.flags"></a>Command Options
</h2></div></div></div><p>
6 The set of features available in the GNU C++ library is shaped by
7 several
<a class=
"link" href=
"http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Invoking-GCC.html" target=
"_top">GCC
8 Command Options
</a>. Options that impact libstdc++ are
9 enumerated and detailed in the table below.
11 The standard library conforms to the dialect of C++ specified by the
12 <code class=
"option">-std
</code> option passed to the compiler.
13 By default,
<span class=
"command"><strong>g++
</strong></span> is equivalent to
14 <span class=
"command"><strong>g++ -std=gnu++
14</strong></span> since GCC
6, and
15 <span class=
"command"><strong>g++ -std=gnu++
98</strong></span> for older releases.
16 </p><div class=
"table"><a id=
"table.cmd_options"></a><p class=
"title"><strong>Table
3.1. C++ Command Options
</strong></p><div class=
"table-contents"><table class=
"table" summary=
"C++ Command Options" border=
"1"><colgroup><col align=
"left" class=
"c1" /><col align=
"left" class=
"c2" /></colgroup><thead><tr><th align=
"left">Option Flags
</th><th align=
"left">Description
</th></tr></thead><tbody><tr><td align=
"left"><code class=
"literal">-std=c++
98</code> or
<code class=
"literal">-std=c++
03</code>
17 </td><td align=
"left">Use the
1998 ISO C++ standard plus amendments.
</td></tr><tr><td align=
"left"><code class=
"literal">-std=gnu++
98</code> or
<code class=
"literal">-std=gnu++
03</code>
18 </td><td align=
"left">As directly above, with GNU extensions.
</td></tr><tr><td align=
"left"><code class=
"literal">-std=c++
11</code></td><td align=
"left">Use the
2011 ISO C++ standard.
</td></tr><tr><td align=
"left"><code class=
"literal">-std=gnu++
11</code></td><td align=
"left">As directly above, with GNU extensions.
</td></tr><tr><td align=
"left"><code class=
"literal">-std=c++
14</code></td><td align=
"left">Use the
2014 ISO C++ standard.
</td></tr><tr><td align=
"left"><code class=
"literal">-std=gnu++
14</code></td><td align=
"left">As directly above, with GNU extensions.
</td></tr><tr><td align=
"left"><code class=
"literal">-fexceptions
</code></td><td align=
"left">See
<a class=
"link" href=
"using_exceptions.html#intro.using.exception.no" title=
"Doing without">exception-free dialect
</a></td></tr><tr><td align=
"left"><code class=
"literal">-frtti
</code></td><td align=
"left">As above, but RTTI-free dialect.
</td></tr><tr><td align=
"left"><code class=
"literal">-pthread
</code></td><td align=
"left">For ISO C++
11
19 <code class=
"filename"><thread
></code>,
20 <code class=
"filename"><future
></code>,
21 <code class=
"filename"><mutex
></code>,
22 or
<code class=
"filename"><condition_variable
></code>.
23 </td></tr><tr><td align=
"left"><code class=
"literal">-latomic
</code></td><td align=
"left">Linking to
<code class=
"filename">libatomic
</code>
24 is required for some uses of ISO C++
11
25 <code class=
"filename"><atomic
></code>.
26 </td></tr><tr><td align=
"left"><code class=
"literal">-lstdc++fs
</code></td><td align=
"left">Linking to
<code class=
"filename">libstdc++fs
</code>
27 is required for use of the Filesystem library extensions in
28 <code class=
"filename"><experimental/filesystem
></code>
29 and the C++
17 Filesystem library in
30 <code class=
"filename"><filesystem
></code>.
31 </td></tr><tr><td align=
"left"><code class=
"literal">-fopenmp
</code></td><td align=
"left">For
<a class=
"link" href=
"parallel_mode.html" title=
"Chapter 18. Parallel Mode">parallel
</a> mode.
</td></tr></tbody></table></div></div><br class=
"table-break" /></div></div><div class=
"navfooter"><hr /><table width=
"100%" summary=
"Navigation footer"><tr><td width=
"40%" align=
"left"><a accesskey=
"p" href=
"make.html">Prev
</a> </td><td width=
"20%" align=
"center"><a accesskey=
"u" href=
"intro.html">Up
</a></td><td width=
"40%" align=
"right"> <a accesskey=
"n" href=
"using_headers.html">Next
</a></td></tr><tr><td width=
"40%" align=
"left" valign=
"top">Make
</td><td width=
"20%" align=
"center"><a accesskey=
"h" href=
"../index.html">Home
</a></td><td width=
"40%" align=
"right" valign=
"top"> Headers
</td></tr></table></div></body></html>