On Tue, Apr 2, 2013 at 8:37 AM, adam.h <adam.p.haj...@gmail.com> wrote:

> Hi All,
>
> I'm trying to learn protobufs and I'm stuck with something which is
> probably very easy to solve.
> I have 2 files, main.proto and common.proto, where "main" is importing
> "common". I compile only "main" (since "common" is imported internally),
> which generates nice Main.java class. However I cannot initiate this
> message, it complains that cannot resolve Common.CommonRequest.
> Inside Main.java I can see references to "messages.Common.CommonRequest".
>
> Should I compile both files then?
>
Yes, you need to compile both files.


> I thought that if one proto imports other protos then it would be enough
> to compile only the master proto and I expected that it will generate all
> required classes inside the Main.java? That would be the case when I would
> define all messages in one file, without imports.
>
> Appreciate any pointers. Some code snippets below.
>
> Thanks,
> Adam
>
>
> //
> -------------------------------------------------------------------------------
> main.proto:
>
> import "common.proto";
>
> package messages;
>
> option java_package = "com.this.msgs.internal";
>
> message Request {
>
>     optional CommonRequest req = 1;
>
> }
>
> //
> -------------------------------------------------------------------------------
> common.proto:
>
> package messages;
>
> message CommonRequest {
>
>     optional uint32 a = 2 [default = 1];
> }
>
>
>
>
>
>  --
> 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 http://groups.google.com/group/protobuf?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 http://groups.google.com/group/protobuf?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to