This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: mingw headers and libraries missing


Georg Troska wrote:
> hi,
> thank you very much for this information
> 
> Where o I find windsock.h and its library? Do I need a SDK (e.g. Visual
> C++) for this?

  Nope, you need the w32api package (you should probably already have it),
this works for both cygwin and mingw compiles and provides headers in
/usr/include/w32api and libraries in /usr/lib/w32api that let you use all the
standard windows OS functions.  The file you're looking for is
/usr/include/w32api/winsock2.h (plain 'winsock.h' only gives the old V1
windows socket interface, nobody uses it any more), and the library is
/usr/lib/w32api/libws2_32.a, the -I and -L options for the compiler should
already be set up correctly so you just write "#include <winsock2.h>" in your
C source and add '-lws2_32' to the compiler command line and away you go.

  Note that you only want this as long as you're using -mno-cygwin; if you
decide to write a Cygwin application, you just use the standard POSIX socket
functions and don't use winsock2.h or libws2_32.a, and the Cygwin DLL takes
care of the rest for you.  (It is even possible to write a Cygwin app that
bypasses the Cygwin DLL POSIX socket functions and uses the winsock API
directly, but it's not a standard thing to do and fraught with possibilities
for bugs to arise, so I'd recommend against it.)

    cheers,
      DaveK

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]