compilation under cygwin

Brian Dessent brian@dessent.net
Tue Aug 5 19:35:00 GMT 2008


Marian Kogler wrote:

> LIBS            = -lpthread -lcurl -lcurlpp -lboost_thread-gcc-mt -lboost_regex-gcc-mt -lstdc++ -lws2_32 -lxml2 -lssl -lcrypto

-lws2_32 is a red flag.  It should not be used from a Cygwin app,
because it indicates that something is trying to use the Winsock API. 
This is not proper with Cygwin programs, which should use the POSIX
style of sockets and not the Win32 API.

> /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:128: error: redefinition of `struct linger'

You're getting a bunch of errors because incluing winsock2.h causes lots
of namespace clashes.  And how could it not?  It provides a different
and incompatible set of definitions for the sockets API which is not
compatible with the standard POSIX definitions in the Cygwin headers. 
Again: the problem is that you should not attempt to use the Winsock API
from a Cygwin application.

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list