Could you provide some more details on what the error message looks like? I
don't see anything obviously wrong with your code, so it's hard to say what
the problem could be.

On Fri, Jan 6, 2017 at 9:01 AM, Doug Lewis <[email protected]> wrote:

> I get a malloc error when I try to add a repeated message element.
>
> Below is the .proto message definition:
>
> message Discovery
> {
>   uint32 lmuSerialNumber = 1;
>   uint64 gpsTime = 2;
>   repeated EquipmentInfo discoveredUnits = 3;
> }
>
> Here is the code where I'm trying to add discoveredUnits to the message:
>
> for (int i = 0; i < numOfAssocMotes; i++)
> {
> EquipmentInfo* assocUnitInfo = outAssocUnitDiscoveryMsg.add_
> associatedunits();
> assocUnitInfo->set_unitserialnumber(mySerialNum);
> assocUnitInfo->set_latitude(myLatitude);
> assocUnitInfo->set_longitude(myLongitude);
> }
>
> I get the malloc error when the add_associatedunits() function is called.
>
> Thanks,
> Doug
>
> --
> 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.
>

-- 
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