Undef lseek first
diff --git a/src/win32/mingw-compat.h b/src/win32/mingw-compat.h
index 8f51d6f..059e39c 100644
--- a/src/win32/mingw-compat.h
+++ b/src/win32/mingw-compat.h
@@ -10,6 +10,7 @@
#if defined(__MINGW32__)
/* use a 64-bit file offset type */
+# undef lseek
# define lseek _lseeki64
# undef stat
# define stat _stati64