Hi Adam,
Please find the below snippet and the associated error:
//Code

                IpInterfaceAddress *i = dynamic_cast<IpInterfaceAddress*> 
(x); //x is of type google::protobuf::Message *
if(i != NULL)
{
DNSServerNames temp;
temp.add_dnsservers("aaa");
i->MutableExtension.SetExtension(a);
                }

//Error:
 error C2228: left of '.SetExtension' must have class/struct/union

And tried following as well
//code:
                IpInterfaceAddress *i = dynamic_cast<IpInterfaceAddress*> 
(x); //x is of type google::protobuf::Message *
if(i != NULL)
{
                            i->AddExtension(dnsServerNames,(char*)value );
                }

//error
error C2664: 'void 
IpInterfaces::IpInterfaceAddress::AddExtension<google::protobuf::internal::MessageTypeTraits<Type>,11,false>(const
 
google::protobuf::internal::ExtensionIdentifier<ExtendeeType,TypeTraitsType,field_type,is_packed>
 
&,const IpInterfaces::DNSServerNames &)' : cannot convert parameter 2 from 
'char *' to 'const IpInterfaces::DNSServerNames &'
          with
          [
              Type=IpInterfaces::DNSServerNames,
              ExtendeeType=IpInterfaces::IpInterfaceAddress,
              
TypeTraitsType=google::protobuf::internal::MessageTypeTraits<IpInterfaces::DNSServerNames>,
              field_type=11,
              is_packed=false
          ]
          Reason: cannot convert from 'char *' to 'const 
IpInterfaces::DNSServerNames'
          No constructor could take the source type, or constructor 
overload resolution was ambiguous

Regards,
Sachin

On Wednesday, November 16, 2016 at 10:09:03 PM UTC+5:30, Adam Cozzette 
wrote:
>
> That should work; you should be able to use repeated fields inside your 
> extension submessage field. I think you might just be running into a syntax 
> issue; could you post the code snippet and the error you're getting?
>
> On Wed, Nov 16, 2016 at 4:08 AM, <[email protected] <javascript:>> 
> wrote:
>
>> import "IpInterfaces.proto";
>> package IpInterfaces;
>>
>> message DNSServerNames{
>> *repeated* string dnsServers=11;//limited only to optional?
>> }
>> extend IpInterfaceAddress{ 
>> optional DNSServerNames dnsServerNames=1000001;
>> }
>>
>> Unable to perform SetExtension(dnsServers,value).
>> Is this supported or is it limited only to OPTIONAL?
>>
>> Thanks in Advance
>>
>> -- 
>> 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 [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to