Issue
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++.
Solution
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
- compile C rather than C++ or
- pass
-std=c++98
or-std=c++03
somewhere or - have a broken installation of gcc.
In any case you probably want to fix the comparison (perhaps change >
or <
to !=
) and only then think of maybe replacing 0
with nullptr
.
Answered By - n. 1.8e9-where's-my-share m.