diff --git a/src/yajl_gen.c b/src/yajl_gen.c
index 0f5c68e..a86a6ed 100644
--- a/src/yajl_gen.c
+++ b/src/yajl_gen.c
@@ -217,7 +217,7 @@ yajl_gen_integer(yajl_gen g, long long int number)
     return yajl_gen_status_ok;
 }
 
-#if defined(_WIN32) || defined(WIN32)
+#if ( defined(_WIN32) || defined(WIN32) ) && !defined(__GNUC__)
 #include <float.h>
 #define isnan _isnan
 #define isinf !_finite
diff --git a/src/yajl_tree.c b/src/yajl_tree.c
index 3d357a3..2b4c183 100644
--- a/src/yajl_tree.c
+++ b/src/yajl_tree.c
@@ -25,7 +25,7 @@
 
 #include "yajl_parser.h"
 
-#if defined(_WIN32) || defined(WIN32)
+#if ( defined(_WIN32) || defined(WIN32) ) && !defined(__GNUC__)
 #define snprintf sprintf_s
 #endif
 
