I'm having a problem including both files.
Now, I know I need to either include Winsock2 first, then windows.h, or simply put:
#define WIN32_LEAN_AND_MEAN
but, I'm still having problems
I have a header file that is called XS.h
which looks like this
#ifndef XS_H
#define XS_H
#include <winsock2.h>
#include <ws2tcpip.h>
#include <Windows.h>
#endif
and I'm including XS.h
in the header Client.h
.
Client.h
include is looks like this :
#ifndef CLIENT_H
#define CLIENT_H
#include "XS.h"
XS.h
is my only include in Client.h
, yet I still get errors (and as you can see, Winsock
is included before windows.h
I'm getting about 78 errors, here are some of them :
Error 90 error C3861: 'WSASetLastError': identifier not found c:program files (x86)windows kits8.0includeumws2tcpip.h 703
Error 61 error C2375: 'WSAStartup' : redefinition; different linkage c:program files (x86)windows kits8.0includeumwinsock2.h 2296
Error 49 error C2375: 'send' : redefinition; different linkage c:program files (x86)windows kits8.0includeumwinsock2.h 2026
How can I solve this issue?
Thanks!
Edit: I've tried to use #define _WINSOCKAPI_
as well, though it did not resolve my problems...
I have winsock.h
first, then windows.h
, though it still does the error for me.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…