Hello I'm working with protobuf but I have a problem.
I have some enum functions but in tow of these I have the same alias, when I try to compile the file for some language "go" the compiler return an error.
I copied the example in protobuf documentation to define the enum and still not working.
enum EnumAllowingAlias {
option allow_alias = true;
UNKNOWN = 0;
STARTED = 1;
RUNNING = 1;
}
enum EnumNotAllowingAlias {
UNKNOWN = 0;
STARTED = 1;
// RUNNING = 1; // Uncommenting this line will cause a compile error inside Google and a warning message outside.
}
This is the google documentation said if you need to use the same alias in some different enums you need to add the option "option allow_alias = true;" in the enum but after try to compile the .proto file the compiler response.
example.proto:13:5: "UNKNOWN" is already defined in "namespace".
example.proto:13:5: Note that enum values use C++ scoping rules, meaning that enum values are siblings of their type, not children of it.
Therefore, "UNKNOWN" must be unique within "kluso", not just within "EnumNotAllowingAlias".example.proto:14:5: "STARTED" is already defined in "namespace".
example.proto:14:5: Note that enum values use C++ scoping rules, meaning that enum values are siblings of their type, not children of it.
Therefore, "STARTED" must be unique within "kluso", not just within "EnumNotAllowingAlias".
I don't know what's happen. Someone know what is the problem?