|
From: Juanvi V. <ju...@gm...> - 2016-08-04 11:43:07
|
Hi all,
Since several weeks ago, I see this error while compiling FlightGear:
error: ‘isnan’ was not declared in this scope
The relevant lines are listed below:
---------------------------
/home/juanvi/FlightGear/flightgear/src/Navaids/PositionedOctree.hxx:63:20:
error: ‘isnan’ was not declared in this scope
assert(!isnan(x));
~~~~~^~~
/home/juanvi/FlightGear/flightgear/src/Navaids/PositionedOctree.hxx:63:20:
note: suggested alternative:
In file included from /usr/local/include/simgear/math/SGCMath.hxx:23:0,
from /usr/local/include/simgear/math/SGMath.hxx:27,
from
/home/juanvi/FlightGear/flightgear/src/Navaids/positioned.hxx:31,
from
/home/juanvi/FlightGear/flightgear/src/Navaids/positioned.cxx:25:
/usr/include/c++/6.1.1/cmath:655:5: note: ‘std::isnan’
isnan(_Tp __x)
^~~~~
make[2]: *** [src/Main/CMakeFiles/fgfs.dir/build.make:5127:
src/Main/CMakeFiles/fgfs.dir/__/Navaids/positioned.cxx.o] Error 1
---------------------------
I did not report this error for weeks because the fix was easy: change
line 63 of PositionedOctree.hxx to use std::isnan(x). This is the diff code:
---------------------------
--- a/src/Navaids/PositionedOctree.hxx
+++ b/src/Navaids/PositionedOctree.hxx
@@ -60,7 +60,7 @@ namespace Octree
_order(x),
_inner(v)
{
- assert(!isnan(x));
+ assert(!std::isnan(x));
}
Ordered(const Ordered<T>& a) :
---------------------------
Anyway, I wonder if this change, which fixes the error in my computer,
works for all systems. I'm using an up to date Arch Linux, and
FlightGear updated to last git.
Also, isnan() (without the std::) is used in other places of flightgear
and simgear, without any complain from the compiler. For example,
isnan() (without the std::) is used in
flightgear/src/Instrumentation/newnavradio.cxx
I don't know why PositionedOctree.hxx needs the std::, while
newnavradio.cxx doesn't.
Is anybody else seeing this error? Does FlightGear compile in other
recent linux systems? Does the file PositionedOctree.hxx need including
an additional header? Is it maybe related to the version of the core
libraries included in Arch Linux?
Regards
Juanvi (ludomotico)
|