我正在尝试用Msys2 mingw32编译luasocket。当我运行make时,我得到了这个错误消息:
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包含在inet.h文件中。我需要设置一些不同的选项才能在mingw中成功编译吗?
发布于 2020-06-04 14:23:33
您的mingw32环境足够新,可以在ws2tcpip.h中使用inet_ntop(),所以src\inet.h不应该重新定义它。
尝试从src\inet.h中删除inet_ntop()。
如果在链接阶段得到与套接字函数相关的未解决的符号错误,则可能需要将-lws2_32添加到链接器标志。
https://stackoverflow.com/questions/60894310
复制相似问题