diff --git a/mongoose.c b/mongoose.c
index 6e8029f276a0dd08e3b6e0fa692fcdc7b54d120e..7895207cc413ec4156885cf0e731fb166f5523c7 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