diff --git a/mongoose.h b/mongoose.h
index 2843f7eeca43ef621f9e09e3946e965661de59df..0ca451dda9f804da59c191564e211ada4eeff351 100644
--- a/mongoose.h
+++ b/mongoose.h
@@ -1669,6 +1669,10 @@ double mg_time();
  * Implementation must ensure that only one callback is invoked at any time.
  */
 
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
 /* Request that a TCP connection is made to the specified address. */
 void mg_if_connect_tcp(struct mg_connection *nc,
                        const union socket_address *sa);
@@ -1730,6 +1734,10 @@ void mg_if_get_conn_addr(struct mg_connection *nc, int remote,
 /* Associate a socket to a connection. */
 void mg_sock_set(struct mg_connection *nc, sock_t sock);
 
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
 #endif /* CS_MONGOOSE_SRC_NET_IF_H_ */
 /*
  * Copyright (c) 2014 Cesanta Software Limited