简体   繁体   中英

Conflicting types for inet_ntop

I am trying to compile luasocket with Msys2 mingw32. When I run make I get this error message:

src\inet.h:48:13: error: conflicting types for 'inet_ntop'
48 | const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt);
  |             ^~~~~~~~~
In file included from src\wsocket.h:12,
             from src\socket.h:18,
             from src\inet.h:18,
             from src\luasocket.c:20:
C:/msys64/mingw32/i686-w64-mingw32/include/ws2tcpip.h:451:35: note: previous declaration of 'inet_ntop' was here
451 | WINSOCK_API_LINKAGE LPCSTR WSAAPI InetNtopA(INT Family, LPCVOID pAddr, LPSTR pStringBuf, size_t StringBufSize);

ws2tcpip is included in inet.h file. Do I need to set some different options to make this compile successfully in mingw?

You're mingw32 environment is recent enough to have inet_ntop() in ws2tcpip.h , so src\\inet.h shouldn't redefine it.

Try to remove inet_ntop() from src\\inet.h .

If you get unresolved symbols errors related to socket function during the link phase you may need to add -lws2_32 to the linker flags.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM