<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><head><metahttp-equiv="Content-Type"content="text/html; charset=UTF-8"/><title>Using</title><metaname="generator"content="DocBook XSL-NS Stylesheets V1.78.1"/><metaname="keywords"content="C++, library, debug"/><metaname="keywords"content="ISO C++, library"/><metaname="keywords"content="ISO C++, runtime, library"/><linkrel="home"href="../index.html"title="The GNU C++ Library"/><linkrel="up"href="debug_mode.html"title="Chapter17.Debug Mode"/><linkrel="prev"href="debug_mode_semantics.html"title="Semantics"/><linkrel="next"href="debug_mode_design.html"title="Design"/></head><body><divclass="navheader"><tablewidth="100%"summary="Navigation header"><tr><thcolspan="3"align="center">Using</th></tr><tr><tdwidth="20%"align="left"><aaccesskey="p"href="debug_mode_semantics.html">Prev</a></td><thwidth="60%"align="center">Chapter17.Debug Mode</th><tdwidth="20%"align="right"><aaccesskey="n"href="debug_mode_design.html">Next</a></td></tr></table><hr/></div><divclass="section"><divclass="titlepage"><div><div><h2class="title"style="clear: both"><aid="manual.ext.debug_mode.using"></a>Using</h2></div></div></div><p>
</p><divclass="section"><divclass="titlepage"><div><div><h3class="title"><aid="debug_mode.using.mode"></a>Using the Debug Mode</h3></div></div></div><p>To use the libstdc++ debug mode, compile your application with the
compiler flag <codeclass="code">-D_GLIBCXX_DEBUG</code>. Note that this flag
changes the sizes and behavior of standard class templates such
as <codeclass="code">std::vector</code>, and therefore you can only link code
compiled with debug mode and code compiled without debug mode if no
instantiation of a container is passed between the two translation
units.</p><p>By default, error messages are formatted to fit on lines of about
78 characters. The environment variable
<codeclass="code">GLIBCXX_DEBUG_MESSAGE_LENGTH</code> can be used to request a
different length.</p></div><divclass="section"><divclass="titlepage"><div><div><h3class="title"><aid="debug_mode.using.specific"></a>Using a Specific Debug Container</h3></div></div></div><p>When it is not feasible to recompile your entire application, or
only specific containers need checking, debugging containers are
available as GNU extensions. These debugging containers are
functionally equivalent to the standard drop-in containers used in
debug mode, but they are available in a separate namespace as GNU
extensions and may be used in programs compiled with either release
mode or with debug mode. The
following table provides the names and headers of the debugging
</p><divclass="table"><aid="table.debug_mode_containers"></a><pclass="title"><strong>Table17.1.Debugging Containers</strong></p><divclass="table-contents"><tablesummary="Debugging Containers"border="1"><colgroup><colalign="left"class="c1"/><colalign="left"class="c2"/><colalign="left"class="c3"/><colalign="left"class="c4"/></colgroup><thead><tr><thalign="left">Container</th><thalign="left">Header</th><thalign="left">Debug container</th><thalign="left">Debug header</th></tr></thead><tbody><tr><tdalign="left"><codeclass="classname">std::bitset</code></td><tdalign="left"><codeclass="filename">bitset</code></td><tdalign="left"><codeclass="classname">__gnu_debug::bitset</code></td><tdalign="left"><codeclass="filename"><debug/bitset></code></td></tr><tr><tdalign="left"><codeclass="classname">std::deque</code></td><tdalign="left"><codeclass="filename">deque</code></td><tdalign="left"><codeclass="classname">__gnu_debug::deque</code></td><tdalign="left"><codeclass="filename"><debug/deque></code></td></tr><tr><tdalign="left"><codeclass="classname">std::list</code></td><tdalign="left"><codeclass="filename">list</code></td><tdalign="left"><codeclass="classname">__gnu_debug::list</code></td><tdalign="left"><codeclass="filename"><debug/list></code></td></tr><tr><tdalign="left"><codeclass="classname">std::map</code></td><tdalign="left"><codeclass="filename">map</code></td><tdalign="left"><codeclass="classname">__gnu_debug::map</code></td><tdalign="left"><codeclass="filename"><debug/map></code></td></tr><tr><tdalign="left"><codeclass="classname">std::multimap</code></td><tdalign="left"><codeclass="filename">map</code></td><tdalign="left"><codeclass="classname">__gnu_debug::multimap</code></td><tdalign="left"><codeclass="filename"><debug/map></code></td></tr><tr><tdalign="left"><codeclass="classname">std::multiset</code></td><tdalign="left"><codeclass="filename">set</code></td><tdalign="left"><codeclass="classname">__gnu_debug::multiset</code></td><tdalign="left"><codeclass="filename"><debug/set></code></td></tr><tr><tdalign="left"><codeclass="classname">std::set</code></td><tdalign="left"><codeclass="filename">set</code></td><tdalign="left"><codeclass="classname">__gnu_debug::set</code></td><tdalign="left"><codeclass="filename"><debug/set></code></td></tr><tr><tdalign="left"><codeclass="classname">std::string</code></td><tdalign="left"><codeclass="filename">string</code></td><tdalign="left"><codeclass="classname">__gnu_debug::string</code></td><tdalign="left"><codeclass="filename"><debug/string></code></td></tr><tr><tdalign="left"><codeclass="classname">std::wstring</code></td><tdalign="left"><codeclass="filename">string</code></td><tdalign="left"><codeclass="classname">__gnu_debug::wstring</code></td><tdalign="left"><codeclass="filename"><debug/string></code></td></tr><tr><tdalign="left"><codeclass="classname">std::basic_string</code></td><tdalign="left"><codeclass="filename">string</code></td><tdalign="left"><codeclass="classname">__gnu_debug::basic_string</code></td><tdalign="left"><codeclass="filename"><debug/string></code></td></tr><tr><tdalign="left"><codeclass="classname">std::vector</code></td><tdalign="left"><codeclass="filename">vector</code></td><tdalign="left"><codeclass="classname">__gnu_debug::vector</code></td><tdalign="left"><codeclass="filename"><debug/vector></code></td></tr></tbody></table></div></div><brclass="table-break"/><p>In addition, when compiling in C++11 mode, these additional