diff --git a/BUILD.gn b/BUILD.gn
index 97aab3a..036c36a 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -22,10 +22,12 @@ config("vulkan_memory_allocator_config") {
       "-Wno-unused-variable",
     ]
   }
-  if (is_win && !is_clang) {
+  if (is_msvc && !is_clang) {
     cflags_cc = [
       "/wd4189",  # local variable is initialized but not referenced
     ]
+  } else if (is_mingw && !is_clang) {
+    cflags_cc = [ "-Wno-unused-variable" ]
   }
   defines = [
     "VMA_DYNAMIC_VULKAN_FUNCTIONS=0",
diff --git a/include/vk_mem_alloc.h b/include/vk_mem_alloc.h
index 0bbfeed..7871149 100644
--- a/include/vk_mem_alloc.h
+++ b/include/vk_mem_alloc.h
@@ -2704,6 +2704,7 @@ remove them if not needed.
     #include <cassert> // for assert
     #include <algorithm> // for min, max
     #include <mutex>
+    #include <cstdio> // for snprintf
 #else
     #include VMA_CONFIGURATION_USER_INCLUDES_H
 #endif
diff --git a/vulkan_memory_allocator.gni b/vulkan_memory_allocator.gni
index 4aa2d79..368b847 100644
--- a/vulkan_memory_allocator.gni
+++ b/vulkan_memory_allocator.gni
@@ -26,10 +26,12 @@ template("vulkan_memory_allocator") {
         "-Wno-unused-variable",
       ]
     }
-    if (is_win && !is_clang) {
+    if (is_msvc && !is_clang) {
       cflags_cc = [
         "/wd4189",  # local variable is initialized but not referenced
       ]
+    } else if (is_mingw && !is_clang) {
+      cflags_cc = [ "-Wno-unused-variable" ]
     }
   }
 
