Hi,
I have a program that works fine on Solaris and Linux and I want to port it to work to on Cygwin, but am having issues getting Boost.asio to compile.
The problem is it wants me to set some defines which I believe makes it use the native Windows socket interface (winsock) where as I want it to use the Cygwin socket interface because the program uses other libraries that expect the Cygwin socket interface. I want to be able to compile a program like this:
$ cat prog.cc
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include <boost/asio.hpp>
int main() {}
$
To get the above code to compile when only including boost/asio.hpp I have to use the following:
g++ -D_WIN32_WINNT=0x0501 -D__USE_W32_SOCKETS \
-I$BOOST_ROOT/include -I$NETSNMP_HOME/include \
prog.cc \
-L$BOOST_ROOT/lib -lboost_system -lws2_32
But the net-snmp headers fail when added, where as when I remove the include for the asio header file and remove -D_WIN32_WINNT=0x0501, -D__USE_W32_SOCKETS and -lws2_32 from the compile line then the net-snmp headers compile fine - but the asio will fail.
g++ -I$BOOST_ROOT/include -I$NETSNMP_HOME/include prog.cc -L$BOOST_ROOT/lib -lboost_system
Is there a define I can set so that boost.asio uses the Cygwin sockets? I would have thought that this would be the expected behaviour when compiling on Cygwin.
The version of Cygwin is:
$ uname -a
CYGWIN_NT-6.0 toshiba-PC 1.7.10(0.259/5/3) 2012-02-05 12:36 i686 Cygwin
The version of boost is:
boost_1_48_0
Thanks