У меня есть следующие файлы protobuf, и я хочу скомпилировать их в C #, используя «protobuf-gen». Я обнаружил, что «chassis.proto» может быть успешным, но «perception_lane.proto» - нет. Я предполагаю, что причина в "common.Header", который должен быть "apollo.common.Header":
Я скомпилировал Базель в C ++, и у них не было этой проблемы. Также можно скомпилировать в python с помощью protoc. Вопрос в том, поддерживает ли сам protobuf это использование? Или «protobuf-net» не распознает такое использование?
header.proto
syntax = "proto2";
package apollo.common;
import "modules/common/proto/error_code.proto";
message Header {
optional double timestamp_sec = 1;
...
}
chassis.proto
syntax = "proto2";
package apollo.canbus;
import "modules/common/proto/header.proto";
message Chassis {
optional apollo.common.Header header = 19;
}
perception_lane.proto
syntax = "proto2";
package apollo.perception;
import "modules/common/proto/header.proto";
message PerceptionLanes {
optional common.Header header = 1;
}
Я получил сообщение об ошибке ниже:
C:\01code\protobuf-net-2.3.16\src\protogen\bin\Release\net462>protogen.exe --proto_path=../net462 --csharp_out=gen +names=original +langver=3 modules/perception/proto/perception_lane.proto
modules/perception/proto/perception_lane.proto(9,14,9,27): error: type not found: 'common.Header'
modules/perception/proto/perception_lane.proto(11,14,11,36): error: type not found: 'camera.CameraErrorCode'
modules/perception/proto/perception_lane.proto(12,14,12,37): error: type not found: 'camera.CameraCalibrator'
modules/perception/proto/perception_lane.proto(13,14,13,35): error: type not found: 'camera.CameraLaneLine'
modules/perception/proto/perception_camera.proto(50,14,50,28): error: type not found: 'common.Point2D'
modules/perception/proto/perception_camera.proto(51,14,51,28): error: type not found: 'common.Point2D'
modules/perception/proto/perception_camera.proto(62,14,62,28): error: type not found: 'common.Point3D'
modules/perception/proto/perception_camera.proto(64,14,64,28): error: type not found: 'common.Point2D'
modules/perception/proto/perception_camera.proto(96,14,96,28): error: type not found: 'common.Point2D'
modules/perception/proto/perception_camera.proto(97,14,97,28): error: type not found: 'common.Point2D'
modules/perception/proto/perception_camera.proto(98,14,98,28): error: type not found: 'common.Point2D'
modules/perception/proto/perception_camera.proto(104,14,104,27): error: type not found: 'common.Header'
modules/perception/proto/perception_obstacle.proto(30,12,30,26): error: type not found: 'common.Point3D'
modules/perception/proto/perception_obstacle.proto(36,12,36,26): error: type not found: 'common.Point3D'
modules/perception/proto/perception_obstacle.proto(48,12,48,26): error: type not found: 'common.Point3D'
modules/perception/proto/perception_obstacle.proto(51,12,51,26): error: type not found: 'common.Point3D'
modules/perception/proto/perception_obstacle.proto(58,12,58,26): error: type not found: 'common.Point3D'
modules/perception/proto/perception_obstacle.proto(86,12,86,26): error: type not found: 'common.Point3D'
modules/perception/proto/perception_obstacle.proto(89,12,89,26): error: type not found: 'common.Point3D'
modules/perception/proto/perception_obstacle.proto(93,12,93,26): error: type not found: 'common.Point3D'
modules/perception/proto/perception_obstacle.proto(157,12,157,25): error: type not found: 'common.Header'
modules/perception/proto/perception_obstacle.proto(158,12,158,28): error: type not found: 'common.ErrorCode'
modules/perception/proto/perception_lane.proto(5,8,5,41): warning: import not used: 'modules/common/proto/header.proto'
modules/perception/proto/perception_lane.proto(6,8,6,56): warning: import not used: 'modules/perception/proto/perception_camera.proto'