-- DanDutrow? - 12 Oct 2010

In cygwin, when compiling any code that includes the boost1.43 version of the <boost/asio.hpp> header, using the following command

g++ -D__USE_W32_SOCKETS -c boost_asio_conftest.cpp
(where boost_asio_conftest.cpp is simply a file that includes boost/asio.hpp)

failures occur such as the following:

/usr/include/boost/asio/detail/posix_fd_set_adapter.hpp:60: error: expected type-specifier before ‘fd_set’

/usr/include/boost/asio/detail/posix_fd_set_adapter.hpp:71: error: ‘fd_set’ does not name a type

/usr/include/boost/asio/detail/posix_fd_set_adapter.hpp: In constructor ‘boost::asio::detail::posix_fd_set_adapter::posix_fd_set_adapter()’:

/usr/include/boost/asio/detail/posix_fd_set_adapter.hpp:40: error: ‘fd_set_’ was not declared in this scope

/usr/include/boost/asio/detail/posix_fd_set_adapter.hpp:40: error: ‘FD_ZERO’ was not declared in this scope

...

Including headers such as <w32api/winsock.h> creates conflicts with <cygwin/socket.h>. What would be the appropriate headers to include?

This issue has been noted all around the web, but I have not found a clear answer to the problem. It's more complicated than including the -D__USE_W32_SOCKETS directive or including asio.hpp before thread.hpp. Are there other system parameters that must be set?

If you were to go the route of including additional directives such as -DBOOST_WINDOWS, you get additional conflicts with the winsock2.h functions and eventually have problems with __try and __except. Adding -D_WIN32_WINNT=0x0501 doesn't particularly help.

Topic revision: r1 - 12 Oct 2010 - 17:23:56 - DanDutrow?
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback