我正在嘗試在 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 關注
- 315 瀏覽
添加回答
舉報
0/150
提交
取消