【发布时间】:2020-11-28 17:35:11
【问题描述】:
这是我正在使用的三个文件:
// city.proto
syntax = "proto3";
package city;
message City {
string cityName = 1;
string zipCode = 2;
string countryName = 3;
}
// street.proto
syntax = "proto3";
import "Exercise/city.proto";
package street;
message Street {
string cityName = 1;
city.City city = 2;
}
// building.proto
syntax = "proto3";
import "Exercise/street.proto";
package building;
message Building {
string buildingName = 1;
string buildingNumber = 2;
street.Street street = 3;
}
这是我当前的目录结构:
- PROTOCOLBUFFERS (folder on desktop)
- Exercise
- city.proto
- street.proto
- building.proto
这是我用来从 proto 文件生成代码的命令
protoc -I="."/Exercise --java_out=Exercise Exercise/*.proto
我正在使用我的终端在 PROTOCOLBUFFERS 文件夹中运行此命令。
我在执行此命令时做错了什么?我在窗户上。 这是我收到的错误消息,在线搜索它没有用。
building.proto:3:1:未找到导入“Exercise/street.proto”或出现错误。
building.proto:10:5: "street.Street" 未定义。
【问题讨论】: