diff --git a/mongoose.c b/mongoose.c
index 6ff4275884af76dadd27a2ae3c0cc2263f12d5e4..2f612484415802d08792b8b58e734d7e064c320d 100644
--- a/mongoose.c
+++ b/mongoose.c
@@ -49,7 +49,9 @@
 #define _XOPEN_SOURCE 600       // For flockfile() on Linux
 #define __STDC_FORMAT_MACROS    // <inttypes.h> wants this for C++
 #define __STDC_LIMIT_MACROS     // C++ wants that for INT64_MAX
+#ifndef _LARGEFILE_SOURCE
 #define _LARGEFILE_SOURCE       // Enable fseeko() and ftello() functions
+#endif
 #define _FILE_OFFSET_BITS 64    // Enable 64-bit file offsets
 
 #ifdef _MSC_VER