error C2375: 'WSAAsyncSelect' : redefinition; different linkage 等错误解决方法(gsoap调用WebService)

错误现象:

Error 35 error C2011: 'fd_set' : 'struct' type redefinition C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 132
Error 38 error C2011: 'hostent' : 'struct' type redefinition C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 232
Error 109 error C2011: 'ip_mreq' : 'struct' type redefinition C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ws2ipdef.h 700
Error 44 error C2011: 'linger' : 'struct' type redefinition C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 500
Error 39 error C2011: 'netent' : 'struct' type redefinition C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 245
Error 41 error C2011: 'protoent' : 'struct' type redefinition C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 264
Error 40 error C2011: 'servent' : 'struct' type redefinition C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 252
Error 26 error C2011: 'sockaddr' : 'struct' type redefinition C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ws2def.h 212
Error 34 error C2011: 'sockaddr_in' : 'struct' type redefinition C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ws2def.h 583
Error 43 error C2011: 'sockproto' : 'struct' type redefinition C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 458
Error 37 error C2011: 'timeval' : 'struct' type redefinition C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 176
Error 42 error C2011: 'WSAData' : 'struct' type redefinition C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 360
Error 27 error C2059: syntax error : 'constant' C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ws2def.h 390
Error 108 error C2079: '_SOCKADDR_INET::Ipv4' uses undefined struct 'sockaddr_in' C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ws2ipdef.h 193
Error 118 error C2079: 'soap::addr' uses undefined struct 'sockaddr' d:\himalaya\folkvideo\nxedit\nxfvmonitordcomserver\fvslavewebservice\stdsoap2.h 2192
Error 119 error C2079: 'soap::in' uses undefined struct 'sockaddr_in' d:\himalaya\folkvideo\nxedit\nxfvmonitordcomserver\fvslavewebservice\stdsoap2.h 2193
Error 98 error C2079: 'sockaddr_gen::Address' uses undefined struct 'sockaddr' C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ws2ipdef.h 75
Error 99 error C2079: 'sockaddr_gen::AddressIn' uses undefined struct 'sockaddr_in' C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ws2ipdef.h 76
Error 52 error C2375: 'accept' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 1578
Error 53 error C2375: 'bind' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 1600
Error 54 error C2375: 'closesocket' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 1619
Error 55 error C2375: 'connect' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 1638
Error 75 error C2375: 'gethostbyaddr' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 2063
Error 76 error C2375: 'gethostbyname' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 2083
Error 77 error C2375: 'gethostname' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 2101
Error 57 error C2375: 'getpeername' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 1680
Error 81 error C2375: 'getprotobyname' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 2178
Error 80 error C2375: 'getprotobynumber' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 2160
Error 79 error C2375: 'getservbyname' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 2141
Error 78 error C2375: 'getservbyport' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 2121
Error 58 error C2375: 'getsockname' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 1701
Error 59 error C2375: 'getsockopt' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 1724
Error 60 error C2375: 'htonl' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 1745
Error 61 error C2375: 'htons' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 1762
Error 62 error C2375: 'inet_addr' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 1780
Error 63 error C2375: 'inet_ntoa' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 1797
Error 56 error C2375: 'ioctlsocket' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 1659
Error 64 error C2375: 'listen' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 1815
Error 65 error C2375: 'ntohl' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 1833
Error 66 error C2375: 'ntohs' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 1850
Error 67 error C2375: 'recv' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 1870
Error 68 error C2375: 'recvfrom' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 1895
Error 69 error C2375: 'select' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 1921
Error 70 error C2375: 'send' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 1945
Error 71 error C2375: 'sendto' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 1970
Error 72 error C2375: 'setsockopt' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 1996
Error 73 error C2375: 'shutdown' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 2018
Error 74 error C2375: 'socket' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 2039
Error 95 error C2375: 'WSAAsyncGetHostByAddr' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 2473
Error 94 error C2375: 'WSAAsyncGetHostByName' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 2446
Error 92 error C2375: 'WSAAsyncGetProtoByName' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 2396
Error 93 error C2375: 'WSAAsyncGetProtoByNumber' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 2421
Error 90 error C2375: 'WSAAsyncGetServByName' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 2343
Error 91 error C2375: 'WSAAsyncGetServByPort' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 2370
Error 97 error C2375: 'WSAAsyncSelect' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 2517
Error 96 error C2375: 'WSACancelAsyncRequest' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 2496
Error 89 error C2375: 'WSACancelBlockingCall' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 2321
Error 83 error C2375: 'WSACleanup' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 2219
Error 85 error C2375: 'WSAGetLastError' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 2253
Error 86 error C2375: 'WSAIsBlocking' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 2270
Error 88 error C2375: 'WSASetBlockingHook' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 2304
Error 84 error C2375: 'WSASetLastError' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 2236
Error 82 error C2375: 'WSAStartup' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 2200
Error 87 error C2375: 'WSAUnhookBlockingHook' : redefinition; different linkage C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winsock2.h 2287
Error 28 error C3805: 'constant': unexpected token, expected either '}' or a ',' C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ws2def.h 390
Error 110 error C3861: 'WSASetLastError': identifier not found C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ws2tcpip.h 664
Error 111 error C3861: 'WSASetLastError': identifier not found C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ws2tcpip.h 671
Error 112 error C3861: 'WSASetLastError': identifier not found C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ws2tcpip.h 709
Error 113 error C3861: 'WSASetLastError': identifier not found C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ws2tcpip.h 716
Error 114 error C3861: 'WSASetLastError': identifier not found C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ws2tcpip.h 760
Error 115 error C3861: 'WSASetLastError': identifier not found C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ws2tcpip.h 767
Error 116 error C3861: 'WSASetLastError': identifier not found C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ws2tcpip.h 807
Error 117 error C3861: 'WSASetLastError': identifier not found C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ws2tcpip.h 814

解决方法:在.cpp文件中添加#include "stdafx.h";解决问题。参考别的信息说是头文件包含问题。

展开阅读全文

没有更多推荐了,返回首页