I’m looking for a header file on windows that I can use to get the ntohl function in C, but Winsock2.h will not work for me. Does anybody know what other header files would provide this?
Here are some errors I get when I try to include Winsock2.h
C:\Program Files (x86)\PellesC\Include\Win\Winsock2.h(1045): error #2120: Redeclaration of 'getservbyport', previously declared at C:\Program Files (x86)\PellesC\Include\Win\winsock.h(468); expected 'PSERVENT __stdcall function(int, const char *)' but found 'struct servent * __stdcall function(int, const char *)'.
C:\Program Files (x86)\PellesC\Include\Win\Winsock2.h(135): error #2123: Redefinition of 'hostent', previously defined at C:\Program Files (x86)\PellesC\Include\Win\winsock.h(91).
C:\Program Files (x86)\PellesC\Include\Win\ws2def.h(39): error #1050: Redefinition of macro 'AF_IPX'.
C:\Program Files (x86)\PellesC\Include\Win\Winsock2.h(1310): error #2121: Redeclaration of 'LPSOCKADDR_IN'.
I solved my own problem eventually. I had neglected to download the windows software development kit and add the include directories etc. in my project. I had assumed that my compiler came with all of the libraries and headers for sockets.