Definition conflicts between winsock2.h and ws2def.h
If you met a strange error regards to winsock2.h and ws2def.h and the error reason is like below:
1>C:\Program Files\Microsoft SDKs\Windows\v7.1\Include\ws2def.h(583) : error C2011: 'sockaddr_in' : 'struct' type redefinition
1> C:\Program Files\Microsoft SDKs\Windows\v7.1\Include\winsock.h(312) : see declaration of 'sockaddr_in'
Maybe this is because you include windows.h before winsock2.h. Trying to reverse that inclusion to make sure windows.h is included after winsock2.h solves the problem!
1>C:\Program Files\Microsoft SDKs\Windows\v7.1\Include\ws2def.h(583) : error C2011: 'sockaddr_in' : 'struct' type redefinition
1> C:\Program Files\Microsoft SDKs\Windows\v7.1\Include\winsock.h(312) : see declaration of 'sockaddr_in'
Maybe this is because you include windows.h before winsock2.h. Trying to reverse that inclusion to make sure windows.h is included after winsock2.h solves the problem!
留言
張貼留言