diff --git a/cores/arduino/syscalls.c b/cores/arduino/syscalls.c
index 6f6487924ef1bab3b3c2ab29718c5eceaf0bae12..add70815f96ba4d103027343015a5ff8eddb6039 100644
--- a/cores/arduino/syscalls.c
+++ b/cores/arduino/syscalls.c
@@ -26,6 +26,10 @@
 #include "syscalls.h"
 #include "sam.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #undef errno
 extern int errno ;
 extern int __end__ ;
@@ -130,3 +134,7 @@ extern int _getpid ( void )
 {
     return -1 ;
 }
+
+#ifdef __cplusplus
+}
+#endif