<blush> yes -- that was it. Thank you!
For future readers:
*message outer*
*{*
* global foo = 1;*
* message inner*
* {*
* int64 j = 2;*
* } inner inside_message = 3;**}*
*message global*
*{*
* int64 k = 3;*
*}*
On Monday, November 28, 2016 at 1:12:12 PM UTC-5, Christian Rivasseau wrote:
>
> 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, <[email protected] <javascript:>> 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 [email protected] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> 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 [email protected].
To post to this group, send email to [email protected].
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/33ff933c-8a85-4678-8273-08104d694a99%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.