diff --git a/acinclude.m4 b/acinclude.m4
index 0b6db8c..53b45e5 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -34,7 +34,6 @@ AC_CACHE_CHECK([for standard C++ header files], [ginac_cv_std_cxx_headers], [
 		#include <cstdio>
 		#include <cstdlib>
 		#include <cstring>
-		#include <cstddef>
 		#include <cstdint>
 		#include <ctime>
 		#include <fstream>
diff --git a/check/mul_eval_memleak.cpp b/check/mul_eval_memleak.cpp
index 7a349e8..4ddc2e2 100644
--- a/check/mul_eval_memleak.cpp
+++ b/check/mul_eval_memleak.cpp
@@ -96,7 +96,6 @@ g(1301*scale^(-1)))*eps^(-1)+F))\
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/resource.h>
-#include <unistd.h>
 
 static void set_VM_limit(const unsigned long MB) {
 	const unsigned mem_lim_kb = MB*1024*1024;
diff --git a/check/timer.cpp b/check/timer.cpp
index 01a7c79..46d173f 100644
--- a/check/timer.cpp
+++ b/check/timer.cpp
@@ -22,7 +22,6 @@
 
 #ifdef HAVE_RUSAGE
 #include <sys/resource.h>
-#include <unistd.h>
 #include <sys/time.h>
 #else
 #include <ctime>
diff --git a/ginac/excompiler.cpp b/ginac/excompiler.cpp
index 6b1ae4c..be424e4 100644
--- a/ginac/excompiler.cpp
+++ b/ginac/excompiler.cpp
@@ -36,10 +36,16 @@
 #include "symbol.h"
 
 #ifdef HAVE_LIBDL
-#include <dlfcn.h>
+# include <dlfcn.h>
 #endif // def HAVE_LIBDL
-#include <unistd.h>
-#include <stdlib.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#else
+# ifdef _MSC_VER
+#  include <io.h>
+# endif // def _MSC_VER
+#endif // def HAVE_UNISTD_H
+#include <cstdlib>
 #include <fstream>
 #include <ios>
 #include <sstream>
