Question

Experts:

I have two .proto files (shown below), the second one has a dependency on the first one.

ImageMessage.proto:

package dvr;

message ImageMessage {
    required int32 width = 1;
    required int32 height = 2;
    required int32 type = 3;
    repeated bytes data = 4;
}

DvrMessage.Proto:

package dvr;

import "ImageMessage.proto";

message DvrMessage {
    required ImageMessage firstImage = 1;
    required ImageMessage secondImage = 2;
}

When I try to compile them as shown here:

protoc --cpp_out=TestProtoc/generated dvrMessage.proto

I receive the following error:

dvrMessage.proto:6:14: "ImageMessage" is not defined.
dvrMessage.proto:7:14: "ImageMessage" is not defined.

I'm importing it. What else do I need to do?

Was it helpful?

Solution

I knew it!!! The minute I post a question, the answer comes. I found a hint in this SO question. Sure enough, I looked at all the .proto files and there was a typo in the package definition for the ImageMessage.proto file.

I hope this helps somebody else. Thank you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top