您的位置:首页 > 其它

You may get compilation errors for afxsock.h

2011-05-17 23:58 274 查看
Build fails with the following errors :
Error 1 error C2065: 'IPPROTO_IPV6' : undeclared identifier c:/program files (x86)/microsoft visual studio 8/vc/atlmfc/include/atlsocket.inl 130
Error 2 error C2065: 'SOCKADDR_STORAGE' : undeclared identifier c:/program files (x86)/microsoft visual studio 8/vc/atlmfc/include/afxsock.h 381
Error 3 error C2146: syntax error : missing ';' before identifier 'sockAddr' c:/program files (x86)/microsoft visual studio 8/vc/atlmfc/include/afxsock.h 381
Error 4 error C2065: 'sockAddr' : undeclared identifier c:/program files (x86)/microsoft visual studio 8/vc/atlmfc/include/afxsock.h 381
Error 5 error C2070: ''unknown-type'': illegal sizeof operand c:/program files (x86)/microsoft visual studio 8/vc/atlmfc/include/afxsock.h 382
Error 6 error C2070: ''unknown-type'': illegal sizeof operand c:/program files (x86)/microsoft visual studio 8/vc/atlmfc/include/afxsock.h 384
Error 7 error C2227: left of '->sin_port' must point to class/struct/union/generic type c:/program files (x86)/microsoft visual studio 8/vc/atlmfc/include/afxsock.h 394
Error 8 error C2146: syntax error : missing ';' before identifier 'sockAddr' c:/program files (x86)/microsoft visual studio 8/vc/atlmfc/include/afxsock.h 402
Error 9 error C2070: ''unknown-type'': illegal sizeof operand c:/program files (x86)/microsoft visual studio 8/vc/atlmfc/include/afxsock.h 403
Error 10 error C2070: ''unknown-type'': illegal sizeof operand c:/program files (x86)/microsoft visual studio 8/vc/atlmfc/include/afxsock.h 405
Error 11 error C2227: left of '->sin_port' must point to class/struct/union/generic type c:/program files (x86)/microsoft visual studio 8/vc/atlmfc/include/afxsock.h 415
Error 12 error C2146: syntax error : missing ';' before identifier 'sockAddr' c:/program files (x86)/microsoft visual studio 8/vc/atlmfc/include/afxsock.h 423
Error 13 error C2070: ''unknown-type'': illegal sizeof operand c:/program files (x86)/microsoft visual studio 8/vc/atlmfc/include/afxsock.h 424
Error 14 error C2070: ''unknown-type'': illegal sizeof operand c:/program files (x86)/microsoft visual studio 8/vc/atlmfc/include/afxsock.h 426
Error 15 error C2227: left of '->sin_port' must point to class/struct/union/generic type c:/program files (x86)/microsoft visual studio 8/vc/atlmfc/include/afxsock.h 436
Error 16 error C2146: syntax error : missing ';' before identifier 'sockAddrSelf' c:/program files (x86)/microsoft visual studio 8/vc/atlmfc/include/afxsock.h 450
Error 17 error C2065: 'sockAddrSelf' : undeclared identifier c:/program files (x86)/microsoft visual studio 8/vc/atlmfc/include/afxsock.h 450
Error 18 error C2070: ''unknown-type'': illegal sizeof operand c:/program files (x86)/microsoft visual studio 8/vc/atlmfc/include/afxsock.h 451
Error 19 error C2070: ''unknown-type'': illegal sizeof operand c:/program files (x86)/microsoft visual studio 8/vc/atlmfc/include/afxsock.h 453

Error 20 error C2228: left of '.ss_family' must have class/struct/union c:/program files (x86)/microsoft visual studio 8/vc/atlmfc/include/afxsock.h 470

原因:

Project has defined _WIN32_WINNT macro value less than minimum recommended for the Operating System, and Windows XP SP2 is minimum required for these structures.
For example, if you set _WIN32_WINNT to 0x0500 or less, you will get the listed errors.

解决办法:

Change the preprocessor definition to a version higher or equal to the minimum recommended.
See Using the Windows Headers for values to use.
If it is inherited from project defaults or parent project uncheck the following settings :
Project->Properties-> Configuration Properties->C/C++->Preprocessor->Preprocessor Definitions->inherit from parent or project defaults.
转自 :http://support.microsoft.com/kb/950688
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐