the inner message defines a class. if you want a field of type inner you have a define that too
Le lun. 28 nov. 2016 19:09, <rkrt...@gmail.com> a écrit : > I'm having a hard time figuring out how to access a nested message that's > defined *within *a message (inline definition). However, I can easily > access a nested message that's defined *outside* of the message. > > What I mean is: > > *message outer* > *{* > * global foo = 1;* > * message inner* > * {* > * int64 j = 2;* > * }* > *}* > > *message global* > *{* > * int64 k = 3;* > *}* > > Accessing the globally-defined message works fine: > > *std::cout << "k is " << request.foo().k() << "\n";* > > But I cannot access the internally-defined message via: > > *std::cout << "j is " << request.inner().j() << "\n";* > > I get a compiler message of > > *error: invalid use of 'helloworld::HelloRequest::inner'* > > I've even tried: > > *std::cout << "j is " << request.j() << "\n"* > > but of course there's no member "j" in "request". > > I'm sure it's something silly that I'm doing :-) [It would be most useful > to put this answer in > https://developers.google.com/protocol-buffers/docs/reference/cpp-generated > near the section with the text "A message can be declared inside another > message. For example: message Foo { message Bar { } } " :-) > > Thanks in advance! > > -- > You received this message because you are subscribed to the Google Groups " > grpc.io" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to grpc-io+unsubscr...@googlegroups.com. > To post to this group, send email to grpc-io@googlegroups.com. > Visit this group at https://groups.google.com/group/grpc-io. > To view this discussion on the web visit > https://groups.google.com/d/msgid/grpc-io/cde3e5aa-b41c-477a-bf4c-a723a040c3fe%40googlegroups.com > <https://groups.google.com/d/msgid/grpc-io/cde3e5aa-b41c-477a-bf4c-a723a040c3fe%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Christian Rivasseau Co-founder and CTO @ Lefty +33 6 67 35 26 74 -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscr...@googlegroups.com. To post to this group, send email to grpc-io@googlegroups.com. Visit this group at https://groups.google.com/group/grpc-io. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/CAJ6g4%3DZY4jXrffBrmf277VfT08ivP1fAMc8fXYjEgzSeftFtSw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.