Home > Software engineering > The error C2678: binary '==' : no operator defined which takes a left - hand operand
The error C2678: binary '==' : no operator defined which takes a left - hand operand
Time:09-29
MFC appear such error: error C2678: binary '==' : no operator defined which takes a left - hand operand of type 'class STD: : basic_string & lt; Char, struct STD: : char_traits & lt; Char> Class, STD: : allocator '(or there is no Acceptable conversion) ? Urgent urgent!!!!!! Error pointing to the wrong here: Int flag=0; Stu CCarSystem *=new CCarSystem; Stu - & gt; M_spinpai=m_strpinpai; String temp; Ifstream in (" a.t xt "); While (in & gt;> Temp) { If (temp==stu - & gt; M_spinpai) { Flag=1; MessageBox (" the brand already exists!" "Notice"); In the close (); M_strpinpai=""; The UpdateData (false);//student id to empty, only keep the rest of the information return; } } In the close ();
There are==there
CodePudding user response:
Left and right side type, can't conversion, so can't compare
CodePudding user response:
Try to use the string: : compare
CodePudding user response:
If (STRCMP (temp. C_str (), stu - & gt; M_spinpai)==0) {