diff --git a/src/json-validator.h b/src/json-validator.h
index db593d508b1541c1a084e5c2523cc1895e40eaca..c405e5b744d6d7077d8f8c729d602c6d2c57049d 100644
--- a/src/json-validator.h
+++ b/src/json-validator.h
@@ -1,5 +1,11 @@
 #ifndef JSON_VALIDATOR_H
-extern "C" {
+#define JSON_VALIDATOR_H
+#ifdef __cplusplus
+extern "C"
+{
+#endif
 bool json_object_validate_schema(struct json_object *j_obj, struct json_object *j_schema);
+#ifdef __cplusplus
 }
+#endif
 #endif
\ No newline at end of file