Boost C++ Libraries: Ticket #7452: Compiling Boost.Asio Example Error [with Clang compiled by MinGW gcc] https://svn.boost.org/trac10/ticket/7452 <p> [Clang compiler and Boost <strong>builded by MinGW GCC 4.7.0</strong>] </p> <p> Running a command </p> <pre class="wiki">c:\lib\boost_1_51_0\doc\html\boost_asio\example\chat&gt;clang++ -std=gnu++11 chat_client.cpp -D_WIN32_WINNT=0x0501 -Ic:/lib/boost_1_51_0 -Lc:/lib/boost_1_51_0/stage/lib -lboost_system-mgw47-mt-1_51 -lboost_thread-mgw47-mt-1_51 -Lc:/MinGW/lib -lws2_32 </pre><p> gives a lot of errors like this one: </p> <pre class="wiki">In file included from chat_client.cpp:16: In file included from c:/lib/boost_1_51_0\boost/thread/thread.hpp:15: In file included from c:/lib/boost_1_51_0\boost/thread/win32/thread_data.hpp:15: '''c:/lib/boost_1_51_0\boost/chrono/system_clocks.hpp:130:15: error: invalid suffix 'i64' on integer constant''' typedef BOOST_SYSTEM_CLOCK_DURATION duration; ^ c:/lib/boost_1_51_0\boost/chrono/system_clocks.hpp:77:111: note: expanded from macro 'BOOST_SYSTEM_CLOCK_DURATION' ...boost::chrono::duration&lt;boost::int_least64_t, ratio&lt;BOOST_RATIO_INTMAX_C(1), BOOST_RATIO_INTMAX_C(10000000)&gt; &gt; ^ c:/lib/boost_1_51_0\boost/ratio/ratio_fwd.hpp:37:42: note: expanded from macro 'BOOST_RATIO_INTMAX_C' #define BOOST_RATIO_INTMAX_C(a) INTMAX_C(a) ^ c:/lib/boost_1_51_0\boost/cstdint.hpp:422:29: note: expanded from macro 'INTMAX_C' # define INTMAX_C(value) value##i64 ^ &lt;scratch space&gt;:52:2: note: expanded from macro '1' 1i64 ^ </pre><p> because in boost/config/compiler/clang.hpp:23 </p> <div class="wiki-code"><div class="code"><pre><span class="cp">#if defined(__int64)</span> <span class="cp"># define BOOST_HAS_MS_INT64</span> <span class="cp">#endif</span> </pre></div></div><p> and in boost/cstdint.h:391 </p> <div class="wiki-code"><div class="code"><pre><span class="cp"># if defined(BOOST_HAS_MS_INT64)</span> <span class="c1">//</span> <span class="c1">// Borland/Intel/Microsoft compilers have width specific suffixes:</span> <span class="c1">//</span> <span class="cp">#ifndef INT8_C</span> <span class="cp"># define INT8_C(value) value##i8</span> <span class="cp">#endif</span> <span class="cp">#ifndef INT16_C</span> <span class="cp"># define INT16_C(value) value##i16</span> <span class="cp">#endif</span> <span class="cp">#ifndef INT32_C</span> <span class="cp"># define INT32_C(value) value##i32</span> <span class="cp">#endif</span> <span class="cp">#ifndef INT64_C</span> <span class="cp"># define INT64_C(value) value##i64</span> <span class="cp">#endif</span> <span class="cp"># ifdef __BORLANDC__</span> <span class="c1">// Borland bug: appending ui8 makes the type a signed char</span> <span class="cp"># define UINT8_C(value) static_cast&lt;unsigned char&gt;(value##u)</span> <span class="cp"># else</span> <span class="cp"># define UINT8_C(value) value##ui8</span> <span class="cp"># endif</span> <span class="cp">#ifndef UINT16_C</span> <span class="cp"># define UINT16_C(value) value##ui16</span> <span class="cp">#endif</span> <span class="cp">#ifndef UINT32_C</span> <span class="cp"># define UINT32_C(value) value##ui32</span> <span class="cp">#endif</span> <span class="cp">#ifndef UINT64_C</span> <span class="cp"># define UINT64_C(value) value##ui64</span> <span class="cp">#endif</span> <span class="cp">#ifndef INTMAX_C</span> <span class="cp"># define INTMAX_C(value) value##i64</span> <span class="cp"># define UINTMAX_C(value) value##ui64</span> <span class="cp">#endif</span> </pre></div></div><hr /> <p> These suffixes are not supported by "GCC version of Clang"(without -fms-extensions) and __int64 - MSVC feature. By the way, "-std=gnu++11 -fms-extensions" looks strange and "crutchly". </p> <pre class="wiki">"-std=gnu++11" - a necessary workaround for Boost.Asio + MinGW </pre><p> In general, replacing line boost\config\compiler\clang.hpp:23 by </p> <div class="wiki-code"><div class="code"><pre><span class="cp">#if defined(__int64) &amp;&amp; !defined(__GNUC__)</span> </pre></div></div><p> solve the problem. </p> <p> Same cure for the Trunk. </p> <p> PS: Sorry for my English. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7452 Trac 1.4.3 Anatoly V. Kalin <anatoly.v.kalin@…> Mon, 01 Oct 2012 17:22:41 GMT attachment set https://svn.boost.org/trac10/ticket/7452 https://svn.boost.org/trac10/ticket/7452 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">clang.hpp.patch</span> </li> </ul> <p> boost\config\compiler\clang.hpp.patch </p> Ticket John Maddock Tue, 19 Feb 2013 16:33:17 GMT <link>https://svn.boost.org/trac10/ticket/7452#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7452#comment:1</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/83009" title="Apply patch from 7452. Refs #7452.">[83009]</a>) Apply patch from 7452. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7452" title="#7452: Patches: Compiling Boost.Asio Example Error [with Clang compiled by MinGW gcc] (closed: fixed)">#7452</a>. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Sun, 24 Feb 2013 19:08:04 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/7452#comment:2 https://svn.boost.org/trac10/ticket/7452#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/83139" title="Merge changes from Trunk. Fixes #6013. Fixes #7151. Fixes #7359. Fixes ...">[83139]</a>) Merge changes from Trunk. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6013" title="#6013: Patches: endian.hpp header patch to utilize OpenBSD's endian header (closed: fixed)">#6013</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7151" title="#7151: Bugs: config.hpp does not define BOOST_HAS_TR1_TUPLE (closed: fixed)">#7151</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7359" title="#7359: Bugs: Compatibility with Intel icpc 13.0 when using -use-clang-env option on ... (closed: fixed)">#7359</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7389" title="#7389: Bugs: __STDC_LIMIT_MACROS can be redefined by boost when using mingw32 (closed: fixed)">#7389</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7452" title="#7452: Patches: Compiling Boost.Asio Example Error [with Clang compiled by MinGW gcc] (closed: fixed)">#7452</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7528" title="#7528: Bugs: Compilation failure on Android and Xbox 360 (closed: fixed)">#7528</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7703" title="#7703: Bugs: endian.hpp for QNX / BlackBerry10 (closed: fixed)">#7703</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7841" title="#7841: Feature Requests: A macro to detect real GCC (closed: fixed)">#7841</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7898" title="#7898: Bugs: TI compiller: wrong decision about type_info presence in boost/config (closed: fixed)">#7898</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7938" title="#7938: Patches: Support vxWorks (closed: fixed)">#7938</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8048" title="#8048: Bugs: Boost 1.53 + GCC 4.6.3 __int128 undefined. (closed: fixed)">#8048</a>. </p> Ticket