Add Winsock2.h Error in Project
1>c:\program files (x86) \ Windows Kits\8.1\include\shared\ws2def.h (+): Warning C4005: ' af_ipx ': Macro redefinition
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (452): See previous definition of ' af_ipx '
1>c:\program files (x86) \ Windows Kits\8.1\include\shared\ws2def.h ($): Warning C4005: ' Af_max ': Macro redefinition
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (471): see previous definition of ' Af_max '
1>c:\program files (x86) \ Windows Kits\8.1\include\shared\ws2def.h (177): Warning C4005: ' So_dontlinger ': macro redefinition
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (394): See previous definition of ' so_dontlinger '
1>c:\program files (x86) \ Windows Kits\8.1\include\shared\ws2def.h (221): Error C2011: ' sockaddr ': ' struct ' type redefinition
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (477): See Declaration of ' sockaddr '
1>c:\program files (x86) \ Windows Kits\8.1\include\shared\ws2def.h (421): Error c2059:syntax error: ' Constant '
1>c:\program files (x86) \ Windows Kits\8.1\include\shared\ws2def.h (421): Error C3805: ' constant ': unexpected token, Expected either '} ' or a ', '
1>c:\program files (x86) \ Windows Kits\8.1\include\shared\ws2def.h (556): Warning C4005: ' In_classa ': macro redefinition
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (279): See previous definition of ' In_classa '
1>c:\program files (x86) \ Windows Kits\8.1\include\shared\ws2def.h (562): Warning C4005: ' IN_CLASSB ': macro redefinition
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (285): See previous definition of ' IN_CLASSB '
1>c:\program files (x86) \ Windows Kits\8.1\include\shared\ws2def.h (568): Warning C4005: ' IN_CLASSC ': macro redefinition
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (291): See previous definition of ' IN_CLASSC '
1>c:\program files (x86) \ Windows Kits\8.1\include\shared\ws2def.h (579): Warning C4005: ' inaddr_any ': macro redefinition
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (296): see previous definition of ' inaddr_any '
1>c:\program files (x86) \ Windows Kits\8.1\include\shared\ws2def.h (581): Warning C4005: ' inaddr_broadcast ': macro redefinition
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (298): See previous definition of ' inaddr_broadcast '
1>c:\program files (x86) \ Windows Kits\8.1\include\shared\ws2def.h (615): Error C2011: ' sockaddr_in ': ' struct ' type redefinition
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (304): See Declaration of ' sockaddr_in '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (136): Error C2011: ' fd_set ': ' struct ' type redefinition
1> C:\Program Files (x86) \ Kits\8.1\include\um\winsock.h: See declaration of ' Fd_set '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (156): Warning C4005: ' fd_clr ': Macro redefinition
1> C:\Program Files (x86) \ kits\8.1\include\um\winsock.h (*): See previous definition of ' fd_clr '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (171): Warning C4005: ' fd_set ': Macro redefinition
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (94): see previous definition of ' fd_set '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h ($): Error C2011: ' timeval ': ' struct ' type redefinition
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (103): See Declaration of ' Timeval '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (236): Error C2011: ' hostent ': ' struct ' type redefinition
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (159): See Declaration of ' hostent '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (249): Error C2011: ' netent ': ' struct ' type redefinition
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (172): See Declaration of ' Netent '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (in): Error C2011: ' servent ': ' struct ' type redefinition
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (179): See Declaration of ' servent '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (268): Error C2011: ' protoent ': ' struct ' type redefinition
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (191): See Declaration of ' Protoent '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (364): Error C2011: ' wsadata ': ' struct ' type redefinition
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (314): See Declaration of ' Wsadata '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (462): Error C2011: ' Sockproto ': ' struct ' type redefinition
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (486): See Declaration of ' Sockproto '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (504): Error C2011: ' Linger ': ' struct ' type redefinition
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (523): See Declaration of ' linger '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (517): Warning C4005: ' somaxconn ': macro redefinition
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (536): See previous definition of ' somaxconn '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (551): Warning C4005: ' fd_read ': Macro redefinition
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (554): see previous definition of ' fd_read '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (554): Warning C4005: ' fd_write ': Macro redefinition
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (555): see previous definition of ' fd_write '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (557): Warning C4005: ' fd_oob ': Macro redefinition
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (556): see previous definition of ' Fd_oob '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (560): Warning C4005: ' fd_accept ': macro redefinition
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (557): see previous definition of ' fd_accept '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (563): Warning C4005: ' fd_connect ': macro redefinition
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (558): See previous definition of ' fd_connect '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (566): Warning C4005: ' fd_close ': Macro redefinition
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (559): See previous definition of ' fd_close '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (1650): Error C2375: ' Accept ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (734): See Declaration of ' Accept '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (1672): Error C2375: ' bind ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (739): See Declaration of ' bind '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (1691): Error C2375: ' closesocket ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (744): See Declaration of ' closesocket '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (1710): Error C2375: ' Connect ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (746): See Declaration of ' Connect '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (1731): Error C2375: ' ioctlsocket ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (751): See Declaration of ' ioctlsocket '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (1752): Error C2375: ' getpeername ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (756): See Declaration of ' Getpeername '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (1773): Error C2375: ' getsockname ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (761): See Declaration of ' getsockname '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (1796): Error C2375: ' getsockopt ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (766): See Declaration of ' getsockopt '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (1817): Error C2375: ' htonl ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (773): See Declaration of ' htonl '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (1834): Error C2375: ' htons ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (775): See Declaration of ' htons '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (1852): Error C2375: ' inet_addr ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (777): See Declaration of ' inet_addr '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (1870): Error C2375: ' Inet_ntoa ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (779): See Declaration of ' Inet_ntoa '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (1971): Error C2375: ' Listen ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (781): See Declaration of ' Listen '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (1989): Error C2375: ' Ntohl ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (785): See Declaration of ' Ntohl '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2006): Error C2375: ' Ntohs ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (787): See Declaration of ' Ntohs '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2026): Error C2375: ' recv ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (789): See Declaration of ' recv '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2051): Error C2375: ' recvfrom ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (795): See Declaration of ' Recvfrom '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2077): Error C2375: ' SELECT ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (803): See Declaration of ' select '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2101): Error C2375: ' send ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (810): See Declaration of ' send '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2126): Error C2375: ' sendto ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (816): See Declaration of ' SendTo '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2152): Error C2375: ' setsockopt ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (824): See Declaration of ' setsockopt '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2174): Error C2375: ' Shutdown ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (831): See Declaration of ' shutdown '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2195): Error C2375: ' socket ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (835): See Declaration of ' sockets '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2220): Error C2375: ' gethostbyaddr ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (842): See Declaration of ' gethostbyaddr '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2240): Error C2375: ' gethostbyname ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (847): See Declaration of ' gethostbyname '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2258): Error C2375: ' gethostname ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (849): See Declaration of ' GetHostName '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2298): Error C2375: ' Getservbyport ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (853): See Declaration of ' Getservbyport '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2317): Error C2375: ' getservbyname ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (857): See Declaration of ' Getservbyname '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2335): Error C2375: ' Getprotobynumber ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (861): See Declaration of ' Getprotobynumber '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2352): Error C2375: ' Getprotobyname ': redefinition ; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (863): See Declaration of ' Getprotobyname '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2373): Error C2375: ' WSAStartup ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (867): See Declaration of ' WSAStartup '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2392): Error C2375: ' WSACleanup ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (871): See Declaration of ' WSACleanup '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2409): Error C2375: ' Wsasetlasterror ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (873): See Declaration of ' Wsasetlasterror '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2426): Error C2375: ' WSAGetLastError ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (875): See Declaration of ' WSAGetLastError '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2447): Error C2375: ' wsaisblocking ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (877): See Declaration of ' wsaisblocking '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2465): Error C2375: ' Wsaunhookblockinghook ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (879): See Declaration of ' Wsaunhookblockinghook '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2483): Error C2375: ' Wsasetblockinghook ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (881): See Declaration of ' Wsasetblockinghook '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2501): Error C2375: ' WSACancelBlockingCall ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (883): See Declaration of ' WSACancelBlockingCall '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2524): Error C2375: ' Wsaasyncgetservbyname ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (885): See Declaration of ' Wsaasyncgetservbyname '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2552): Error C2375: ' Wsaasyncgetservbyport ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (893): See Declaration of ' Wsaasyncgetservbyport '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2579): Error C2375: ' Wsaasyncgetprotobyname ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (901): See Declaration of ' Wsaasyncgetprotobyname '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2605): Error C2375: ' Wsaasyncgetprotobynumber ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (908): See Declaration of ' Wsaasyncgetprotobynumber '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2631): Error C2375: ' WSAAsyncGetHostByName ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (915): See Declaration of ' WSAAsyncGetHostByName '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2659): Error C2375: ' wsaasyncgethostbyaddr ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (922): See Declaration of ' wsaasyncgethostbyaddr '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2683): Error C2375: ' Wsacancelasyncrequest ': redefinition; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (931): See Declaration of ' Wsacancelasyncrequest '
1>c:\program files (x86) \ Windows Kits\8.1\include\um\winsock2.h (2704): Error C2375: ' WSAAsyncSelect ': redefinition ; Different linkage
1> C:\Program Files (x86) \ Windows Kits\8.1\include\um\winsock.h (933): see Declaration of ' WSAAsyncSelect '
Workaround:
Includes # include <Winsock2.h> before # include <windows.h>
Contains Winsock2.h error issues