我正在尝试在 gRPC 中生成客户端和服务器代码。我已经从 github 安装了 grpc 目录并尝试生成C++代码。我安装了 proto 编译器 3.0.0。当我执行 protoc 时,出现以下错误$ protoc -I ../../protos/ --grpc_out=. --plugin=protoc-gen-grpc=grpc_cpp_plugin ../../protos/helloworld.protogrpc_cpp_plugin: program not found or is not executable--grpc_out: protoc-gen-grpc: Plugin failed with status code 1.知道为什么我无法生成客户端/服务器代码
1 回答
qq_笑_17
TA贡献1818条经验 获得超7个赞
检查您的/usr/local/bin. 它应该与其他语言的插件一起存在。
/usr/local/bin > ll
total 71144
-rwxr-xr-x 1 root root 12721867 Oct 23 10:44 grpc_cpp_plugin*
-rwxr-xr-x 1 root root 14509678 Oct 23 10:44 grpc_csharp_plugin*
-rwxr-xr-x 1 root root 13339870 Oct 23 10:44 grpc_objective_c_plugin*
-rwxr-xr-x 1 root root 12569518 Oct 23 10:44 grpc_python_plugin*
-rwxr-xr-x 1 root root 12393363 Oct 23 10:44 grpc_ruby_plugin*
如果您确实有其他插件但没有 cpp,则您可能在安装时忽略了一些东西。
如果在那里尝试在编译时指定完整路径(即--plugin=protoc-gen-grpc=/usr/local/bin/grpc_cpp_plugin)
如果您有多个版本的 protobuf,请检查您是否使用同一个版本的 protoc 和插件。
- 1 回答
- 0 关注
- 423 浏览
添加回答
举报
0/150
提交
取消
