error C2106: '=' : left operand must be l-value

前端 未结 4 1556
Happy的楠姐
Happy的楠姐 2020-12-20 17:48

Looking at the other questions regarding error C2106, I am still lost as to what the issue is with my code. While compiling I get the following errors:

c

4条回答
  •  忘掉有多难
    2020-12-20 18:40

    the term l-value in c++ means the 'left-value' is of the improper type. Since you are using the assignment operator on it, to be the proper type it must be a value that can be assigned a new value, which means it can not be a constant. Most likely, your call to payroll.at() is returning a constant value instead of a reference to the actual value. Trying to assign a new value to it will then cause an l-value error.

提交回复
热议问题