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
您应将&&用于&运算:
if ((modus==2) && (move != -1))
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.
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
}
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.