最近做IPV6兼容升级,发现包含了winsock2.h后,会出现编译报错。部分报错信息如下:
winsock2.h(109) : error C2011: 'fd_set' : 'struct' type redefinition
winsock2.h(144) : warning C4005: 'FD_SET' : macro redefinition
winsock.h(88) : see previous definition of 'FD_SET'
winsock2.h(153) : error C2011: 'timeval' : 'struct' type redefinition
winsock2.h(209) : error C2011: 'hostent' : 'struct' type redefinition
winsock2.h(222) : error C2011: 'netent' : 'struct' type redefinition
winsock2.h(229) : error C2011: 'servent' : 'struct' type redefinition
winsock2.h(241) : error C2011: 'protoent' : 'struct' type redefinition
winsock2.h(397) : error C2011: 'sockaddr_in' : 'struct' type redefinition
winsock2.h(407) : error C2011: 'WSAData' : 'struct' type redefinition
经过调查,发现是由于我原