Reputation: 861
I get an error when I try to compare two integers in Qt.
if ((modus==2) & (move != -1))
error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator!='
Do I need other operators? I have googled but it seems that Qt uses the same. Thanks for your ansers
Upvotes: 0
Views: 1616
Reputation: 861
Thanks to you, but I found it. The variable "move" belongs to QPoint or something like this. I just renamed my varible and everything is doing fine. Thanks anyway.
Upvotes: 0
Reputation: 100638
If you're using a C++0x compiler, move
might conflict with std::move()
. I'm thinking that's what's causing the "unresolved overloaded function type" part of the error message.
Upvotes: 4
Reputation: 524
The operator you're using (&) is a "binary and", not the "logical and" you seem to want (&&). Assuming both 'modus' and 'move' are of type int, it should work fine:
if (modus==2 && move!=-1) {
// stuff
}
Upvotes: 0
Reputation: 12333
You should use && for the and-operation:
if ((modus==2) && (move != -1))
Upvotes: 5