C++ Help
- Login to post comments
Mon, 05/14/2012 - 18:32
Hi everyone,
I've been working on a project in C++, and it's suddenly failing to compile. The error is at:
ClassName& ClassName::operator += (ClassName &p){ (*this) = (*this) + p; return *this; }
(with a real class, of course)
Error message: no match found for operator = in *ClassName*this operator = operator+(ClassName&).
Any idea why this suddenly happened? The only code changed was completely unrelated.
Do you need the parentheses around
*this
?I tweet like a bird
I have a lame website
I thought operator precedence might be my problem, but they didn't fix it.
Another Planet finally has an official release! Download chapters 1 through 3 here! Thank you for waiting so long while I kept starting over.
Personally I'd check if there's something weird in the bit that you changed the code. Missing a paranthesis or semicolon sometimes causes weird stuff to happen later/earlier on in the code. Of course my experience comes from AS3, but it probably counts with C++ too.
New GooFans Rules | My Addins
My guess would be this line:
If you messed with operator+() or operator=(), or removed either, this may fail. What line is the error for?
My other guess would be to replace
with
Spacing may be a problem, but then again, may be nothing at all.
If you can't figure it out, and want me to look at the code, I'd be more than happy to.
IRC | Chapter Tutorial | Reference Guide