I am trying to compile this .c code in windows using MinGW (gcc file.c -o compiled.exe):
/***************************************************/
/* AUTHOR
Check your socket.h - that's most likely where it's defined. Your code compiles fine with CygWin since the socket.h contains (by virtue of the fact it includes cygwin/socket.h):
typedef int socklen_t;
As a kludge, you could try adding that line to your own code. But you should still investigate why it's missing and maybe raise a bug report.
There's a great many pages complaining that MinGW doesn't support socklen_t, for example here, here, here and here, the last of which states that it lives in ws2tcpip.h as I defined it in my kludge above.