diff --git a/contrib/mpeg_encode/bitio.cpp b/contrib/mpeg_encode/bitio.cpp
index 1805a1aef7865e6c42063c24a10c2b0d7bdb0dfc..69b5303dea2e9e2e70220e983e79749d04800465 100644
--- a/contrib/mpeg_encode/bitio.cpp
+++ b/contrib/mpeg_encode/bitio.cpp
@@ -13,8 +13,6 @@
  *									     *
  *===========================================================================*/
 
-#define htonl(x) (x) // gmsh
-
 /*
  * Copyright (c) 1995 The Regents of the University of California.
  * All rights reserved.
@@ -89,7 +87,6 @@
 #include "bitio.h"
 #include "mtypes.h"
 
-
 /*===============================*
  * INTERNAL PROCEDURE prototypes *
  *===============================*/
diff --git a/contrib/mpeg_encode/headers/byteorder.h b/contrib/mpeg_encode/headers/byteorder.h
index ac97874eb89c7bbd83fbf294f55da278c34751c7..3dc75f1d31bb17f0dceb9a107e7ef2591c90ba1a 100644
--- a/contrib/mpeg_encode/headers/byteorder.h
+++ b/contrib/mpeg_encode/headers/byteorder.h
@@ -72,5 +72,13 @@
 #else
     /* let in.h handle it, if possible */                  
 #include <sys/types.h>
+
+// gmsh: for windows
+#if !defined(WIN32) || defined(__CYGWIN__)
+#include <netinet/in.h>
+#else
+#include <winsock.h>
+#endif
+
 #endif /* FORCE_LITTLE_ENDIAN */
 #endif /* FORCE_BIG_ENDIAN */
diff --git a/contrib/mpeg_encode/headers/general.h b/contrib/mpeg_encode/headers/general.h
index 5c1dc02c9ce01cf34aa807916d1aec41929996cc..a4782c897bc3540a263202bf12914178cdde20dc 100644
--- a/contrib/mpeg_encode/headers/general.h
+++ b/contrib/mpeg_encode/headers/general.h
@@ -115,7 +115,10 @@ int pclose();
  * TYPE DEFINITIONS *
  *==================*/
 
-typedef int boolean;
+// gmsh: cannot use a typedef because windows does, too -> use a #define 
+//typedef int boolean;
+#define boolean int
+
 /* this is for JPEG stuff */
 #define BOOLEAN_DEFINED
 #define HAVE_BOOLEAN