--- a/cgi.h
+++ b/cgi.h
@@ -24,6 +24,10 @@
 extern "C" {
 #endif
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct var_s {
 	char	*name,
 		*value;
@@ -146,4 +150,8 @@ char *cgiEscape (char *string);
 extern }
 #endif
 
+#ifdef __cplusplus
+} /* end of extern "C" */
+#endif
+
 #endif /* _CGI_H_ */
