本文介绍了sockaddr_in6没有声明?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将ipv4服务器/客户端移植到ipv6,但是编译器说SOCKADDR_IN6
未在作用域中声明.声明了SOCKADDR_IN
,但没有声明.包括<Winsock2.h>
.
I'm trying to port an ipv4 server/client to ipv6, but the compiler says SOCKADDR_IN6
is not declared in the scope. SOCKADDR_IN
is declared but not SOCKADDR_IN6
. <Winsock2.h>
is included.
任何人都有为什么不声明它的任何想法?
Any one have any ideas why it would be undeclared?
推荐答案
Microsoft的文档对于sockaddr_in6
说它是在ws2tcpip.h
标头中定义的,可能您需要包括它.
Microsoft's documentation for sockaddr_in6
says that it is defined in the ws2tcpip.h
header, probably you need to include that.
在Linux上,您需要不同的包含,sys/socket.h
和netinet/in.h
.
On Linux you'd need different includes, sys/socket.h
and netinet/in.h
.
这篇关于sockaddr_in6没有声明?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!