I believe this is to be expected, because these top-level extensions would
end up having the same name. For example in C++ they would both be called
example::exOptions and so there would be a conflict there. To get around
this you can either give them different names or keep the same names but
nest them inside of messages, like this:

message MessageOptionsExtension {
  extend google.protobuf.MessageOptions {
    ExFieldOptions exOptions = 4245;
  }
}

On Mon, Mar 13, 2017 at 1:15 PM, Arpit Baldeva <abald...@gmail.com> wrote:

> Hi,
>
> I have my proto file like following.
>
> package example;
>
> message ExFieldOptions
> {
>   map<string, string> meta_data = 1;
> }
>
> extend google.protobuf.FieldOptions
> {
>     ExFieldOptions exOptions = 4245;
> }
>
> extend google.protobuf.MessageOptions
> {
>     ExFieldOptions exOptions = 4245;
> }
>
> When I run it through ProtoC (for C++ code generation), I run into an error
>
> "exOptions" is already defined in "example".
>
> Is this a bug? Or is it required that extension name need to be unique
> across options?
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to