Muk*_*uka 8 protocol-buffers dart grpc protoc
如果需求我设置path为protoc获得进口标准协议缓冲器(protobuf的),像empty.proto和timestamp.proto在Windows和飞镖?
当protoc为然:
protoc --dart_out=grpc:lib/src/protos/generated -Iprotos protos/organization.proto --plugin=protoc-gen-dart=D:\Users\Samuel\AppData\Roaming\Pub\Cache\bin\protoc- gen-dart.bat
出现以下错误:
google/protobuf/empty.proto:找不到文件。organization.proto:未找到导入“google/protobuf/empty.proto”或有错误。organization.proto:14:27: 未定义“google.protobuf.Empty”。
在插件上的IntelliJ 中Settings,定义了标准原型 (*.proto) 的位置:Protobuf Supportpath
此外,这path是在 IntelliJ 中定义的Project Structure\ Global Libraries:
organization.proto导入google/protobuf/empty.proto使用Empty类的代码:
syntax = "proto3";
package auge.protobuf;
import "google/protobuf/empty.proto";
service OrganizationService {
rpc GetOrganizations (google.protobuf.Empty) returns (OrganizationsResponse) {}
}
Run Code Online (Sandbox Code Playgroud)
IntelliJ 分析器识别出IDEA 上的import "google/protobuf/empty.proto"和Empty类,但protoc找不到。
环境是:
假设你有/some/path/to/google/protobuf/empty.proto,你需要传递--proto_path=/some/path/to/以便 protoc 可以找到它。
| 归档时间: |
|
| 查看次数: |
2856 次 |
| 最近记录: |