lvalue required

alfesani picture alfesani · Oct 9, 2010 · Viewed 31.5k times · Source

what does the error message "Lvalue required" actually mean?

Answer

Paul Dixon picture Paul Dixon · Oct 9, 2010

An lvalue is something that can appear on the left side of an assignment, in other words 'something that can be assigned'

So, look for an assignment where the left hand side isn't 'assignable', for example, something as simple as this might trigger such an error

if (0 = foo)
{

}

Here you've got an attempt to assign to a constant because of accidentally using = rather than ==

See also