Boost C++ Libraries: Ticket #4816: [BOOST::ASIO] Under Cygwin <boost/asio.hpp> doesn't compile https://svn.boost.org/trac10/ticket/4816 <p> Environment: Cygwin </p> <p> Compiler: gcc </p> <h2 class="section" id="a1stissue">1st issue</h2> <p> boost/asio.hpp includes another header making references to the 'pipe_select_interrupter' but fails to include: boost/asio/detail/pipe_select_interrupter.hpp Where it is effectively defined </p> <h2 class="section" id="a2ndissue">2nd issue</h2> <p> The C function 'cfgetospeed' is referenced by: boost/asio/impl/serial_port_base.ipp </p> <p> But the inclusion of &lt;termios.h&gt; is not done under Cygwin and more, the cfgetospeed function is a macro, hence the statement on line 135 fails: </p> <pre class="wiki"> speed_t baud = ::cfgetospeed(&amp;storage); </pre><h2 class="section" id="a3rdissue">3rd issue</h2> <p> boost/asio/detail/buffer_sequence_adapter.hpp </p> <p> Makes references to the WSABUF structure when under Cygwin, but this structure exists only under the WIN32 environment. To compile I have to undefine the <code>__CYGWIN__</code> macro before including this header. </p> <h2 class="section" id="Howtoreproduce">How to reproduce</h2> <p> The following program doesn't compile: </p> <pre class="wiki">/// gcc -c bug.cpp doesn't compile #include &lt;cstdlib&gt; #include &lt;cstring&gt; #include &lt;iostream&gt; #include &lt;boost/asio.hpp&gt; int main(int argc, char* argv[]) { return 0; } </pre><h3 class="section" id="Userfix">User fix</h3> <p> I fix these issue in my programs by adding the following code BEFORE including &lt;boost/asio.hpp&gt; </p> <pre class="wiki">/// 1st issue #include &lt;boost/asio/detail/pipe_select_interrupter.hpp&gt; /// 2nd issue #ifdef __CYGWIN__ #include &lt;termios.h&gt; #ifdef cfgetospeed #define __cfgetospeed__impl(tp) cfgetospeed(tp) #undef cfgetospeed inline speed_t cfgetospeed(const struct termios *tp) { return __cfgetospeed__impl(tp); } #undef __cfgetospeed__impl #endif /// cfgetospeed is a macro /// 3rd issue #undef __CYGWIN__ #include &lt;boost/asio/detail/buffer_sequence_adapter.hpp&gt; #define __CYGWIN__ #endif </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4816 Trac 1.4.3 frederic.jardon@… Fri, 05 Nov 2010 16:23:58 GMT attachment set https://svn.boost.org/trac10/ticket/4816 https://svn.boost.org/trac10/ticket/4816 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost_asio_bug_cygwin.cpp</span> </li> </ul> <p> Program demonstrating the bug </p> Ticket frederic.jardon@… Fri, 05 Nov 2010 16:24:22 GMT attachment set https://svn.boost.org/trac10/ticket/4816 https://svn.boost.org/trac10/ticket/4816 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">error_log.txt</span> </li> </ul> <p> Error log when compiling with gcc </p> Ticket frederic.jardon@… Fri, 05 Nov 2010 16:25:34 GMT attachment set https://svn.boost.org/trac10/ticket/4816 https://svn.boost.org/trac10/ticket/4816 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost_asio_bug_cygwin_with_fix.cpp</span> </li> </ul> <p> A corrected version which compiles correctly </p> Ticket