Including winsock2.h, in a file of a project.
Getting many errors in -WinSock2.h(109) : error C2011: 'fd_set' : 'struct' type redefinition
with a corresponding -WinSock.h(54) : see declaration of 'fd_set'
I don't see winsock.h included in any of the headers.
Are there any setting in the project that may be causing this?
EDIT
However, I am using windows.h in another file:
http://cboard.cprogramming.com/windows-programming/41212-strange-msvc-winsock2-compile-error.html
EDIT 2
In the header I have:
#include <winsock2.h> #include <iphlpapi.h> #include "\MyFiles\FileX.h" <-which #include <windows.h>
My educated guess would be the order of included headers, i.e. include winsock2.h
first (with first meaning before windows.h
), or define WIN32_LEAN_AND_MEAN before including windows.h
, which prevents windows.h from including winsock v1.
#include <winsock2.h> #include <windows.h>
-or-
#define WIN32_LEAN_AND_MEAN #include <windows.h> #include <winsock2.h>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With