【发布时间】:2020-04-08 03:16:19
【问题描述】:
我刚开始使用 GRPC,但在设置和获取参数时遇到了麻烦。
这是我声明我的 proto 文件的方式:
syntax="proto3";
package student;
message Student {
string name = 1;
int32 age = 2;
}
然后我使用命令编译生成头文件和cpp文件:
protoc -I=./ --cpp_out=./ ./student.proto
现在我如何设置和获取学生的年龄:
#include <stdio.h>
#include "student.pb.h"
int main() {
puts("Hello");
// Now set and get the age
return 0;
}
【问题讨论】:
标签: c++ c protocol-buffers grpc