diff --git a/cpp/utils.cc b/cpp/utils.cc index 86ea54c..e2702af 100644 --- a/cpp/utils.cc +++ b/cpp/utils.cc @@ -9,7 +9,10 @@ #include #include +#include +#if GOOGLE_PROTOBUF_VERSION > 2005000 #include +#endif #include "framework/cpp/utils.h" @@ -535,11 +538,15 @@ namespace f8 std::string PbToJson(google::protobuf::Message* pbmsg) { std::string json; +#if GOOGLE_PROTOBUF_VERSION > 2005000 google::protobuf::util::JsonPrintOptions options; options.add_whitespace = true; options.always_print_primitive_fields = true; options.preserve_proto_field_names = true; MessageToJsonString(*pbmsg, &json, options).ok(); +#else + json = "{}"; +#endif return json; }