Conflicting types for inet_ntop

749 Views Asked by At

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?

1

There are 1 best solutions below

0
Brecht Sanders On

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.