socklen_t undeclared when compiling .c code

后端 未结 5 927
-上瘾入骨i
-上瘾入骨i 2020-12-29 07:43

I am trying to compile this .c code in windows using MinGW (gcc file.c -o compiled.exe):

/***************************************************/ 
/* AUTHOR             


        
5条回答
  •  长发绾君心
    2020-12-29 07:48

    For Windows, to get a definition for socklen_t:

    #include 
    

    Valid as of VS2017 and this writing; based on https://docs.microsoft.com/en-us/windows/win32/api/ws2tcpip/nf-ws2tcpip-getnameinfo.

    Two other headers I've found I needed to port a particular Linux based socket source file to Windows are:

    #include 
    #include    
    

提交回复
热议问题