Error: 2 overloads have no legal conversion for this pointer, when protocol buffer method is invoked

769 views Asked by At

Could someone help me figure this error C2663: MediaSetting::mutable_mediamessage: 2 overloads have no legal conversion for this pointer happened, when mutable_mediamessage() is called in the following codes.

class MediaSetting : public ::google::protobuf::Message {
 public:
  inline ::MSG::MediaMessage* mutable_mediamessage(int index);
  inline ::google::protobuf::RepeatedPtrField< ::MSG::MediaMessage >* mutable_mediamessage();
}

inline ::MSG::MediaMessage* MediaSetting::mutable_mediamessage(int index) {
  return mediamessage_.Mutable(index);
}

inline ::google::protobuf::RepeatedPtrField< ::MSG::MediaMessage >*
MediaSetting::mutable_mediamessage() {
  return &mediamessage_;
}

// my test codes
// ...
const ::MSG::MediaSetting& media = config.mediasetting();
::google::protobuf::RepeatedPtrField<::MSG::MediaMessage>* pmedia = media.mutable_mediamessage(); // Error C2663 is here

Environment: VS2008

1

There are 1 answers

0
marom On BEST ANSWER

You are attempting to access a non-const member function via a const reference.