# Include <winsock2.h> error,
# Define PORT 5150
# Define DATA_BUFSIZE 8192
Typedef struct _ SOCKET_INFORMATION {
CHAR Buffer [DATA_BUFSIZE];
WSABUF DataBuf;
SOCKET Socket;
WSAOVERLAPPED Overlapped;
DWORD BytesSEND;
DWORD BytesRECV;
} SOCKET_INFORMATION, * LPSOCKET_INFORMATION;
Dword winapi ProcessIO (LPVOID lpParameter );
DWORD EventTotal = 0;
WSAEVENT EventArray [WSA_MAXIMUM_WAIT_EVENTS];
LPSOCKET_INFORMATION SocketArray [WSA_MAXIMUM_WAIT_EVENTS];
CRITICAL_SECTION CriticalSection;
The above data must contain files # include <winsock2.h>
If the include order is:
# Include <stdio. h>
# Include <windows. h>
# Include <commctrl. h>
# Include <winsock2.h>
# Include "resource. h"
# Include "Definition. h"
There will be a lot of errors, as shown below:
1> c: \ program files \ microsoft sdks \ windows \ v7.0a \ include \ ws2def. h (91): warning C4005: "AF_IPX": Macro redefinition
1> c: \ program files \ microsoft sdks \ windows \ v7.0a \ include \ winsock. h (460): see the previous definition of "AF_IPX ".
1> c: \ program files \ microsoft sdks \ windows \ v7.0a \ include \ ws2def. h (131): warning C4005: "AF_MAX": Macro redefinition
1> c: \ program files \ microsoft sdks \ windows \ v7.0a \ include \ winsock. h (479): see the previous definition of "AF_MAX"
1> c: \ program files \ microsoft sdks \ windows \ v7.0a \ include \ ws2def. h (168): warning C4005: "SO_DONTLINGER": Macro redefinition
1> c: \ program files \ microsoft sdks \ windows \ v7.0a \ include \ winsock. h (402): see the previous definition of "SO_DONTLINGER"
1> c: \ program files \ microsoft sdks \ windows \ v7.0a \ include \ ws2def. h (212): error C2011: "sockaddr": "struct" type redefinition
1> c: \ program files \ microsoft sdks \ windows \ v7.0a \ include \ winsock. h (485): See the sockaddr statement.
1> c: \ program files \ microsoft sdks \ windows \ v7.0a \ include \ ws2def. h (390): error C2059: syntax error: "constant"
1> c: \ program files \ microsoft sdks \ windows \ v7.0a \ include \ ws2def. h (390): error C3805: "constant": Unexpected mark. Enter "}" or ","
1> c: \ program files \ microsoft sdks \ windows \ v7.0a \ include \ ws2def. h (524): warning C4005: "IN_CLASSA": Macro redefinition
1> c: \ program files \ microsoft sdks \ windows \ v7.0a \ include \ winsock. h (287): see the previous definition of "IN_CLASSA"
1> c: \ program files \ microsoft sdks \ windows \ v7.0a \ include \ ws2def. h (530): warning C4005: "IN_CLASSB": Macro redefinition
1> c: \ program files \ microsoft sdks \ windows \ v7.0a \ include \ winsock. h (293): see the previous definition of "IN_CLASSB"
1> c: \ program files \ microsoft sdks \ windows \ v7.0a \ include \ ws2def. h (536): warning C4005: "IN_CLASSC": Macro redefinition
*
*
*
*
*
*
Now, change the include order:
The include order is as follows:
# Include <winsock2.h>
# Include <stdio. h>
# Include <windows. h>
# Include <commctrl. h>
# Include "resource. h"
# Include "Definition. h"
There will be no compilation errors.
Compiling environment: VS2010