diff --git a/binding-mri/etc-binding.cpp b/binding-mri/etc-binding.cpp
index 931f182..2c2cdd2 100644
--- a/binding-mri/etc-binding.cpp
+++ b/binding-mri/etc-binding.cpp
@@ -19,10 +19,6 @@
** along with mkxp. If not, see .
*/
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_DEPRECATE
-#endif
-
#include "etc.h"
#include "binding-util.h"
#include "serializable-binding.h"
diff --git a/binding-mri/font-binding.cpp b/binding-mri/font-binding.cpp
index df1efbc..2a8856a 100644
--- a/binding-mri/font-binding.cpp
+++ b/binding-mri/font-binding.cpp
@@ -19,10 +19,6 @@
** along with mkxp. If not, see .
*/
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_DEPRECATE
-#endif
-
#include "font.h"
#include "binding-util.h"
#include "binding-types.h"
diff --git a/binding-mri/input-binding.cpp b/binding-mri/input-binding.cpp
index 5c00dd3..f20b06a 100644
--- a/binding-mri/input-binding.cpp
+++ b/binding-mri/input-binding.cpp
@@ -19,10 +19,6 @@
** along with mkxp. If not, see .
*/
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_DEPRECATE
-#endif
-
#include "input.h"
#include "sharedstate.h"
#include "exception.h"
diff --git a/src/crossplatform.h b/src/crossplatform.h
index 9f4bef6..26f4993 100644
--- a/src/crossplatform.h
+++ b/src/crossplatform.h
@@ -1,7 +1,17 @@
+#ifndef MKXP_CROSSPLATFORM_H
+#define MKXP_CROSSPLATFORM_H
+
#ifdef _MSC_VER
-#define snprintf _snprintf
+//#define _CRT_SECURE_NO_DEPRECATE //should be defined in binding-mri's preprocessor for vsnprintf, fopen
#include
+#ifndef snprintf
+#define snprintf _snprintf
+#endif
+#ifndef chdir
#define chdir _chdir
-#endif
\ No newline at end of file
+#endif
+#endif
+
+#endif //MKXP_CROSSPLATFORM_H
diff --git a/src/exception.h b/src/exception.h
index 5746df7..02db28e 100644
--- a/src/exception.h
+++ b/src/exception.h
@@ -22,9 +22,8 @@
#ifndef EXCEPTION_H
#define EXCEPTION_H
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_DEPRECATE
-#endif
+#include "crossplatform.h"
+
#include
#include
#include
diff --git a/src/util.h b/src/util.h
index f2461cd..214d057 100644
--- a/src/util.h
+++ b/src/util.h
@@ -22,9 +22,8 @@
#ifndef UTIL_H
#define UTIL_H
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_DEPRECATE
-#endif
+#include "crossplatform.h"
+
#include
#include
#include