diff --git a/lib/config-win32.h b/lib/config-win32.h
index b1463741eae21a0b970b883dcf56a9a7be0503bd..4336e19e0694a934007f42aa8634f76c0baf1ade 100644
--- a/lib/config-win32.h
+++ b/lib/config-win32.h
@@ -232,6 +232,11 @@
 /* Define if you have the <unistd.h> header file.  */
 #define HAVE_UNISTD_H 1
 
+#else
+
+/* MSVC needs an underscore */
+#define snprintf _snprintf
+
 #endif
 
 #endif
diff --git a/src/config-win32.h b/src/config-win32.h
index 308ab2d2c1cc4274d4ae44fe00f7d0ef47564054..1d7a4688e930235981f3593b16bf591e4324e2f6 100644
--- a/src/config-win32.h
+++ b/src/config-win32.h
@@ -29,9 +29,15 @@
 /*************************************************
  * This section is for compiler specific defines.*
  *************************************************/
-#ifdef MINGW32 /* Borland and MS don't have this */
+/* Borland and MS don't have this */
+#if defined(MINGW32) || defined(__WATCOMC__) || defined(__LCC__)
 
 /* Define if you have the <unistd.h> header file.  */
 #define HAVE_UNISTD_H 1
 
+#else
+
+/* MSVC needs an underscore */
+#define snprintf _snprintf
+
 #endif