socklen_t undeclared when compiling .c code

后端 未结 5 938
-上瘾入骨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:59

    According to the Unix Specification, socket.h makes available a type, socklen_t, which is an unsigned opaque integral type of length of at least 32 bits. Apparently MingW doesn't include it.

    You can define it as:

    #include 
    typedef uint32_t socklen_t;
    

提交回复
热议问题