Boost logo

Boost :

Subject: [boost] [asio and thread] don't play well together under cygwin?
From: Brian and Victoria (bnv_at_[hidden])
Date: 2009-03-10 22:39:26


Greetings,

I have a header file that includes both <boost/thread> and <boost/asio>,
which results in the compilation errors below under cygwin. If I take
out <boost/thread> then things are fine, except that I need it for my
application :) I have "-D__USE_W32_SOCKETS -D_WIN32_WINNT=0x0501" in my
compile flags, per the asio documentation. Taking them out appears to
resolve the errors below, but causes other errors for asio.

Has anyone else run into this problem and found a solution?

-Brian

In file included from /usr/include/cygwin/sys_time.h:13,
                 from /usr/include/sys/time.h:27,
                 from
/usr/local/include/boost-1_38/boost/date_time/c_time.hpp:31,
                 from
/usr/local/include/boost-1_38/boost/date_time/microsec_time_clock.hpp:21,
                 from
/usr/local/include/boost-1_38/boost/thread/thread_time.hpp:9,
                 from
/usr/local/include/boost-1_38/boost/thread/locks.hpp:12,
                 from
/usr/local/include/boost-1_38/boost/thread/pthread/mutex.hpp:11,
                 from
/usr/local/include/boost-1_38/boost/thread/mutex.hpp:16,
                 from
/usr/local/include/boost-1_38/boost/thread/pthread/thread_data.hpp:12,
                 from
/usr/local/include/boost-1_38/boost/thread/thread.hpp:17,
                 from /usr/local/include/boost-1_38/boost/thread.hpp:13,
                 from chat.cpp:23:
/usr/include/sys/select.h:31: error: `fd_set' has not been declared
/usr/include/sys/select.h:31: error: `fd_set' has not been declared
/usr/include/sys/select.h:31: error: `fd_set' has not been declared
/usr/include/sys/select.h:33: error: `fd_set' has not been declared
/usr/include/sys/select.h:33: error: `fd_set' has not been declared
/usr/include/sys/select.h:33: error: `fd_set' has not been declared
In file included from
/usr/local/include/boost-1_38/boost/asio/detail/socket_types.hpp:79,
                 from
/usr/local/include/boost-1_38/boost/asio/detail/win_iocp_io_service_fwd.hpp:24,
                 from
/usr/local/include/boost-1_38/boost/asio/io_service.hpp:37,
                 from
/usr/local/include/boost-1_38/boost/asio/basic_io_object.hpp:20,
                 from
/usr/local/include/boost-1_38/boost/asio/basic_socket.hpp:24,
                 from
/usr/local/include/boost-1_38/boost/asio/basic_datagram_socket.hpp:25,
                 from /usr/local/include/boost-1_38/boost/asio.hpp:20,
                 from chat.cpp:30:
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:109:
error: redefinition of `struct timeval'
/usr/include/sys/time.h:16: error: previous definition of `struct timeval'
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.h:632:
error: declaration of C function `int select(int, fd_set*, fd_set*,
fd_set*, const timeval*)' conflicts with
/usr/include/sys/select.h:31: error: previous declaration `int
select(int, int*, int*, int*, timeval*)' here


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk