googleprobuf C++使用须知

来源:互联网 发布:linux软件百度云 编辑:程序博客网 时间:2024/05/22 04:55

当在linux下调用protobuf,并且该protobuf里有缺省字符串时。

例如:

message test

{

    required string a = 1;

    optional string b=2 [default = "-2"];

}

 

必须在protobuf类析构前调用google::protobuf::ShutdownProtobufLibrary();

否则则用出现报错:缺省字符串的析构出错。

 

使用GOOGLE_PROTOBUF_VERIFY_VERSION宏可以对protobuf库的版本进行校验,以防库不对的现象发生。