繁体   English   中英

inet_ntop 的冲突类型

[英]Conflicting types for inet_ntop

我正在尝试使用 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 中成功编译?

您的 mingw32 环境足够新,可以在ws2tcpip.h包含inet_ntop() ,因此src\\inet.h不应重新定义它。

尝试从src\\inet.h删除inet_ntop()

如果在链接阶段遇到与套接字函数相关的未解决符号错误,您可能需要将-lws2_32添加到链接器标志。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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