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
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
相关文章推荐
- python get this week days and last week day maybe help for you
- docker 解决:Get http:///var/run/docker.sock/v1.19/version: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?
- Is there any way to get detailed error information for Win32 errors when using Platform Invoke?
- git操作提示 Auto packing the repository for optimum performance. You may also run "git gc" manually
- git pull 或者执行一些其他git操作 Auto packing the repository for optimum performance. You may also run "git gc
- Momma always said: "Life is like a box of chocolates, Forrest. You never know what you're gonna get."
- Unable to start debugging on the web server. The web server is not configured correctly. See help for common configuration errors. Running the web page outside of the debugger may provide further information.
- git操作提示 Auto packing the repository for optimum performance. You may also run "git gc" manually. See
- Are you looking for a way to get the entire text of a word document into a RichEdit without using the Clipboard?
- android - See Build Numbers for a full listing of branches you may choose from
- there are things you need to test for to get test coverage
- just have a click the link,you may get surprise
- passwd: You may not view or modify password information for root.
- You should not be calling AfxGetMainWnd in a worker thread
- Compilation errors for FUNCTION AWCARGOWEBJMNEW.FUN_GETVSLVOY161110 Error: PLS-00103: Encountered t
- You Get What You Pay For @ JDJ
- Mysql can't get hostname for you address解决方案
- Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -
- Science Says This Is How to Make the Perfect First Impression You only get one chance for a first i
- QT 5.7 for iOS Xcode 8 Project ERROR: Xcode not set up properly. You may need to confirm the license