【发布时间】:2015-05-06 18:08:25
【问题描述】:
我正在尝试使用 Google protobuf,我有以下描述:
message.proto 文件:
message Request {
required int32 id = 1;
optional string value = 2;
}
service.proto 文件:
import "message.proto";
service Service {
rpc request (Request) returns (bool);
}
我正在尝试生成 c++ 源代码并收到错误:
$ protoc service.proto --cpp_out=/tmp/proto/build
service.proto:4:40:预期的消息类型。
我必须只返回用户定义的类型吗?是否支持原始(如bool 或string)?我可以使用原始类型作为服务方法参数(而不是我的示例中的Request)吗?
【问题讨论】:
-
message Bool { bool status = 1; }怎么样
标签: protocol-buffers rpc protobuf-c