diff --git a/miosix/filesystem/stringpart.cpp b/miosix/filesystem/stringpart.cpp
index d70f3deddd15ceca5d9b8b662beee5a9bba1b948..03be75b87b7e23731ceef10d5972760a1aabd459 100644
--- a/miosix/filesystem/stringpart.cpp
+++ b/miosix/filesystem/stringpart.cpp
@@ -26,7 +26,9 @@
  ***************************************************************************/
 
 //Makes memrchr available in newer GCCs
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE
+#endif
 #include <string.h>
 
 #include "stringpart.h"