the correct syntax for the extending file is...

import "extended_file.proto";

extend extended_package.<'.' separated qualified path to type (if
nested within one or more messages/groups)>ExtendedMessage {
    optional int32 field = 100;
}

On Jan 5, 5:57 am, Chris Dew <cms...@gmail.com> wrote:
> How do you use extensions across multiple .proto files?
>
> http://code.google.com/apis/protocolbuffers/docs/proto.html#extensions
>
> see line:  // This can even be in a different file.
>
> I've tried:
> protoc -I=./ --java_out=./ ./wrapper.proto ./attach.proto
>
> but get the error: attach.proto:6:8:
> "Wrapper" is not defined.
>
> I feel I need some form of #include, but have not seen any
> documentation for this.
>
> Thanks,
>
> Chris.
>
> wrapper.proto:
>
> package pbtest;
>
> option java_package = "pbtest";
> option java_outer_classname = "WrapperProtos";
>
> message Wrapper {
>   required string address = 1;
>   optional sfixed64 timestamp = 2;
>   required int64 sequence = 3;
>   optional bool ack_not_required = 4;
>   extensions 7 to 100;
>
> }
>
> attach.proto:
>
> package pbtest;
>
> option java_package = "pbtest";
> option java_outer_classname = "WrapperProtos";
>
> extend Wrapper {
>   optional Attach attach = 8;
>
> }
>
> message Attach {
>   required sfixed32 pv = 1;
>   required sfixed32 attempt = 2;
>
>
>
>
>
>
>
> }

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to