diff --git a/src/file.c b/src/file.c
index bd602ef2b83f97fc50767487916c30c3b0fc62c5..d38c5a2516b3955fbb13bad9f8553f82e8553b2b 100644
--- a/src/file.c
+++ b/src/file.c
@@ -14,7 +14,6 @@
 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
-#include <io.h>
 #include <limits.h>
 #include <stdbool.h>
 #include <stdio.h>
@@ -26,6 +25,7 @@
 // On Windows, define ssize_t manually
 #ifdef _WIN32
 #define ssize_t __int64
+#include <io.h>
 #else
 #include <unistd.h>
 #endif