diff --git a/src/m_class.c b/src/m_class.c
index e959264320366088911699b1c92e05bee3030b82..aa44022d1a9f2d598684fb61b26f6c3a3aa40f78 100644
--- a/src/m_class.c
+++ b/src/m_class.c
@@ -18,6 +18,10 @@
 #include <string.h>
 #include <stdio.h>
 
+#ifdef _MSC_VER  /* This is only for Microsoft's compiler, not cygwin, e.g. */
+#define snprintf sprintf_s
+#endif
+
 static t_symbol *class_loadsym;     /* name under which an extern is invoked */
 static void pd_defaultfloat(t_pd *x, t_float f);
 static void pd_defaultlist(t_pd *x, t_symbol *s, int argc, t_atom *argv);