Reputation: 105
For CPP programming, I have defined a enum
in a .proto file and I have to use the same enum in another .proto file.
//first.proto
package A;
enum foo
{
COUNTRY_UNKNOWN = 0;
COUNTRY_INDIA = 1;
}
I want to use the foo
data structure in another .proto file like this:
//second.proto
package B;
message bar
{
foo currentCountry = 1;
}
I tried to just import package A
into second.proto file but it is not able to work. I'm new to protobuf and CPP programming. Please guide.
Upvotes: 8
Views: 4821
Reputation: 375
update like this:
import 'first.proto';
package B;
message
{
A.foo currentCountry = 1;
}
Upvotes: 10