tags:

views:

152

answers:

2

Hi

Did anyone try to include winsock2.h and then tried to compile it on cygwin? Unfortuantely I get the following error message:

winsock2.h:635: error: declaration of C function 'int gethostname(char*, int)' conflicts with /usr/include/sys/unistd.h:2006: error: previous declaration 'int gethostname(char, size t)' here

Does anyone know how I can fix this "bug"?

Thanks

A: 

Cygwin is an environment for compiling POSIX compliant programs on Windows. If you want to compile Windows compliant programs on Windows, use MinGW instead.

anon
+1  A: 

winsock2.h is for the Windows enviroment. The cygwin headers should contain sys/socket.h. Use that instead.

AShelly