diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index f55a5a3f7c4ddeea810dbae886bd31769c3df833..db28184f3e77757ef44866a267865408fb187826 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -21,6 +21,7 @@
 #include <m_string.h>
 #include <my_sys.h>
 #include <getopt.h>
+#include <my_pthread.h>
 #include <thr_alarm.h>
 #include <mysql.h>
 #include "log_event.h"
diff --git a/include/my_pthread.h b/include/my_pthread.h
index d31d09896dc781a00c09c410638ada185cc2f297..79baa7a53e37df61939f9097ac07df79941e0417 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -25,6 +25,10 @@
 #define ETIME ETIMEDOUT				/* For FreeBSD */
 #endif
 
+#ifdef  __cplusplus
+extern "C" {
+#endif /* __cplusplus */ 
+
 #if defined(__WIN__) || defined(OS2)
 
 #ifdef OS2
@@ -612,4 +616,9 @@ extern struct st_my_thread_var *_my_thread_var(void) __attribute__ ((const));
 #endif /* SAFE_STATISTICS */
 #endif /* HAVE_ATOMIC_ADD */
 #endif /* thread_safe_increment */
+
+#ifdef  __cplusplus
+}
+#endif
+
 #endif /* _my_ptread_h */