I am trying to overload operators to add PPM images together, creating a new image. However, When trying to make a new object in the function,
PPM& PPM::operator*(const double& rhs) const {
int height = this->getHeight();
int width = this-> getWidth();
int mc = this-> getMaxColorValue();
PPM lhs;
// ...
return lhs;
}
And there's a bunch of other stuff, ending with return(lhs); When I try to compile the code, I get an error saying:
error: reference to local variable 'lhs' returned [-Werror=return-local-addr] PPM lhs;
What is going wrong?