Reputation: 139
I am using GCC 7.5. When building packages, it complains about ordered comparison between integer and pointer, so I change the 0 in the comparison to nullptr.
But then I receive an error message that "'nullptr' was not declared in this scope".
Trying adding options -std=c++11 or -std=c++14 does not help.
All the programs are in C++.
Upvotes: 0
Views: 190
Reputation: 119877
it complains about ordered comparison between integer and pointer
"Ordered comparison" means comparison with >
or <
or >=
or <=
. It makes no sense to compare a pointer with a null pointer constant this way.
so I change the 0 in the comparison to nullptr
This doesn't make the comparison any more meaningful. It makes no sense to compare a pointer with a null pointer constant this way either.
But then I receive an error message that "'nullptr' was not declared in this scope".
This cannot happen with gcc 7.5 unless you
-std=c++98
or -std=c++03
somewhere orIn any case you probably want to fix the comparison (perhaps change >
or <
to !=
) and only then think of maybe replacing 0
with nullptr
.
Upvotes: 1