Use mutable_repomessage()->set_nodeid... - see the C++ tutorial an intro to the generated accessors. https://developers.google.com/protocol-buffers/docs/cpptutorial
On Mon, Nov 5, 2012 at 1:59 AM, Javier Blesa Martínez <[email protected]>wrote: > Hi, > > I have a protobuf definition: > > message CBMessage { > > required int32 type = 1; //defines the kind of message that we send > optional RepoMessage repomessage = 2; > > message RepoMessage { > optional int32 nodeid = 1; > } > > And I would like to change the nodeid inside the RepoMessage: > > CBTxMessages::CBMessage* cbmsg; > cbmsg = new CBTxMessages::CBMessage; > > this->cbmsg->repomessage().set_nodeid(message[0]); > > but I have an error when compile: > > error: pasar ‘const CBTxMessages::CBMessage_RepoMessage’ como el argumento > ‘this’ de ‘void > CBTxMessages::CBMessage_RepoMessage::set_nodeid(google::protobuf::int32)’ > descarta a los calificadores [-fpermissive] > > I understand that the function repomessage() is const, and the problem is > related with that, but how can I solved? > > Someone can help me, please? > > Best regards, > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/protobuf/-/BL2qdZLLfpcJ. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/protobuf?hl=en. > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
