Boost C++ Libraries: Ticket #12176: Chrono without linking to Boost.System https://svn.boost.org/trac10/ticket/12176 <p> In the chrono docs we have: </p> <pre class="wiki">How to Build Boost.Chrono as a Header Only Library? When BOOST_CHRONO_HEADER_ONLY is defined the lib is header-only. If in addition BOOST_USE_WINDOWS_H is defined &lt;windows.h&gt; is included, otherwise files in boost/detail/win are used to reduce the impact of including &lt;windows.h&gt;. However, you will either need to define BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING or link with Boost.System. </pre><p> But when I followed this chrono still linked with Boost.System. Here is the code: </p> <pre class="wiki">#define BOOST_CHRONO_HEADER_ONLY #define BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING // #define BOOST_SYSTEM_NO_DEPRECATED #include &lt;iostream&gt; #include &lt;boost/chrono.hpp&gt; #include &lt;boost/ratio.hpp&gt; int main() { typedef boost::chrono::duration&lt;int, boost::ratio&lt;1, 100000000&gt; &gt; shakes; typedef boost::chrono::duration&lt;int, boost::centi&gt; jiffies; typedef boost::chrono::duration&lt;float, boost::ratio&lt;12096,10000&gt; &gt; microfortnights; typedef boost::chrono::duration&lt;float, boost::ratio&lt;3155,1000&gt; &gt; nanocenturies; boost::chrono::seconds sec(1); std::cout &lt;&lt; "1 second is:\n"; std::cout &lt;&lt; boost::chrono::duration_cast&lt;shakes&gt;(sec).count() &lt;&lt; " shakes\n"; std::cout &lt;&lt; boost::chrono::duration_cast&lt;jiffies&gt;(sec).count() &lt;&lt; " jiffies\n"; std::cout &lt;&lt; microfortnights(sec).count() &lt;&lt; " microfortnights\n"; std::cout &lt;&lt; nanocenturies(sec).count() &lt;&lt; " nanocenturies\n"; return 0; } </pre><p> The link error message is: </p> <pre class="wiki">gcc.link C:\Programming\VersionControl\modular-boost\build\boost\bin.v2\libs\cxx_dual\test\test_chrono_boost.test\gcc-mingw-5.3\debug\test_chrono_boost.exe C:\Programming\VersionControl\modular-boost\build\boost\bin.v2\libs\cxx_dual\test\test_chrono_boost.test\gcc-mingw-5.3\debug\test_chrono_boost.o: In function `_static_initialization_and_destruction_0': E:\Programming\VersionControl\modular-boost\libs\cxx_dual\test/../../../boost/system/error_code.hpp:221: undefined reference to `boost::system::generic_category()' E:\Programming\VersionControl\modular-boost\libs\cxx_dual\test/../../../boost/system/error_code.hpp:222: undefined reference to `boost::system::generic_category()' E:\Programming\VersionControl\modular-boost\libs\cxx_dual\test/../../../boost/system/error_code.hpp:223: undefined reference to `boost::system::system_category()' collect2.exe: error: ld returned 1 exit status </pre><p> If I uncomment the line: </p> <pre class="wiki">// #define BOOST_SYSTEM_NO_DEPRECATED </pre><p> then chrono links without requiring Boost.System. </p> <p> Maybe this bug is one of documentation and the documentation should be changed to specify that BOOST_SYSTEM_NO_DEPRECATED must also be defined in order to remove the chrono dependency on Boost.System. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12176 Trac 1.4.3 Edward Diener Wed, 04 May 2016 13:06:32 GMT component changed; owner set https://svn.boost.org/trac10/ticket/12176#comment:1 https://svn.boost.org/trac10/ticket/12176#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">viboes</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">chrono</span> </li> </ul> Ticket viboes Wed, 04 May 2016 22:02:00 GMT status changed https://svn.boost.org/trac10/ticket/12176#comment:2 https://svn.boost.org/trac10/ticket/12176#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> Hi, </p> <p> please could you check if this <a class="ext-link" href="https://github.com/boostorg/chrono/commit/6f34fae179795bd449f4921b0de837b05b17022d"><span class="icon">​</span>https://github.com/boostorg/chrono/commit/6f34fae179795bd449f4921b0de837b05b17022d</a> solves the issue? </p> Ticket Edward Diener Thu, 05 May 2016 10:24:18 GMT <link>https://svn.boost.org/trac10/ticket/12176#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12176#comment:3</guid> <description> <p> The latest change on develop fixes the issue. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Mon, 09 May 2016 06:05:27 GMT</pubDate> <title>milestone changed https://svn.boost.org/trac10/ticket/12176#comment:4 https://svn.boost.org/trac10/ticket/12176#comment:4 <ul> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.62.0</span> </li> </ul> Ticket viboes Fri, 19 Aug 2016 21:12:22 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/12176#comment:5 https://svn.boost.org/trac10/ticket/12176#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket