diff --git a/mongoose.h b/mongoose.h
index 348af899f3e7c13059f5f0a3246baae32ef0f86d..38d5425c4dcd72484a3d832def4606a4614be862 100644
--- a/mongoose.h
+++ b/mongoose.h
@@ -177,8 +177,10 @@
 #define vsnprintf _vsnprintf
 #define sleep(x) Sleep((x) *1000)
 #define to64(x) _atoi64(x)
+#if !defined(__MINGW32__) && !defined(__MINGW64__)
 #define popen(x, y) _popen((x), (y))
 #define pclose(x) _pclose(x)
+#endif
 #define rmdir _rmdir
 #if defined(_MSC_VER) && _MSC_VER >= 1400
 #define fseeko(x, y, z) _fseeki64((x), (y), (z))