diff --git a/mongoose.h b/mongoose.h
index e92be6a813c0a8312e7a39c9ffc3c45c00b70c32..8d8a6e02abf1d99a90fac225cffce9cd7c66ebd5 100644
--- a/mongoose.h
+++ b/mongoose.h
@@ -443,6 +443,10 @@ typedef struct stat cs_stat_t;
 
 /* Some functions we implement for Mongoose. */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #ifdef __TI_COMPILER_VERSION__
 struct SlTimeval_t;
 #define timeval SlTimeval_t
@@ -510,6 +514,10 @@ struct dirent *readdir(DIR *dir);
 #define MG_FS_SLFS
 #endif
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* CS_PLATFORM == CS_P_CC3200 */
 #endif /* CS_COMMON_PLATFORMS_PLATFORM_CC3200_H_ */
 /*
@@ -557,6 +565,10 @@ typedef struct stat cs_stat_t;
 
 /* Some functions we implement for Mongoose. */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #ifdef __TI_COMPILER_VERSION__
 struct SlTimeval_t;
 #define timeval SlTimeval_t
@@ -604,6 +616,10 @@ int _stat(const char *pathname, struct stat *st);
 
 #endif /* __TI_COMPILER_VERSION__ */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* CS_PLATFORM == CS_P_MSP432 */
 #endif /* CS_COMMON_PLATFORMS_PLATFORM_MSP432_H_ */
 /*