From: "Daniel P. Berrange" <berrange(a)redhat.com>
Some GNULIB headers (eg unistd.h) will often need to include
winsock2.h for various symbols. There is a rule that winsock2.h
must be included before windows.h. This means that any file
which does
#ifdef WIN32
#include <windows.h>
#endif
#include <unistd.h>
is potentially broken. A simple rule is that /all/ includes of
windows.h must be matched with a preceeding include of winsock2.h
regardless of whether unistd.h is used currently
---
src/util/util.c | 3 +++
src/vbox/vbox_MSCOMGlue.c | 3 +++
2 files changed, 6 insertions(+)
diff --git a/src/util/util.c b/src/util/util.c
index 28a4fe7..a71b0d6 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -65,6 +65,9 @@
#endif
#ifdef WIN32
+# ifdef HAVE_WINSOCK2_H
+# include <winsock2.h>
+# endif
# include <windows.h>
# include <shlobj.h>
#endif
diff --git a/src/vbox/vbox_MSCOMGlue.c b/src/vbox/vbox_MSCOMGlue.c
index b07d6a7..68810fb 100644
--- a/src/vbox/vbox_MSCOMGlue.c
+++ b/src/vbox/vbox_MSCOMGlue.c
@@ -22,6 +22,9 @@
#include <config.h>
+#ifdef HAVE_WINSOCK2_H
+# include <winsock2.h>
+#endif
#include <windows.h>
#define nsCID CLSID
--
1.7.10.2