pdfviewer/PDFDocument.cpp: In member function ‘void PDFWidget::goToPageRelativePosition(int, float, float)’:
pdfviewer/PDFDocument.cpp:968:18: error: ‘isnan’ was not declared in this scope
if (isnan(xinpdf)) xinpdf = 0;
^
pdfviewer/PDFDocument.cpp:968:18: note: suggested alternative:
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/5.3.0/include/g++-v5/random:38:0,
from /usr/lib/gcc/x86_64-pc-linux-gnu/5.3.0/include/g++-v5/bits/stl_algo.h:66,
from /usr/lib/gcc/x86_64-pc-linux-gnu/5.3.0/include/g++-v5/algorithm:62,
from /usr/include/qt5/QtCore/qglobal.h:85,
from /usr/include/qt5/QtCore/qnamespace.h:37,
from /usr/include/qt5/QtCore/qobjectdefs.h:41,
from /usr/include/qt5/QtCore/qobject.h:40,
from /usr/include/qt5/QtCore/QObject:1,
from ./modifiedQObject.h:44,
from ./mostQtHeaders.h:12,
from pdfviewer/PDFDocument.h:28,
from pdfviewer/PDFDocument.cpp:24:
/usr/lib/gcc/x86_64-pc-linux-gnu/5.3.0/include/g++-v5/cmath:641:5: note: ‘std::isnan’
isnan(_Tp __x)
^
pdfviewer/PDFDocument.cpp:970:18: error: ‘isnan’ was not declared in this scope
if (isnan(yinpdf)) yinpdf = 0;
^
pdfviewer/PDFDocument.cpp:970:18: note: suggested alternative:
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/5.3.0/include/g++-v5/random:38:0,
from /usr/lib/gcc/x86_64-pc-linux-gnu/5.3.0/include/g++-v5/bits/stl_algo.h:66,
from /usr/lib/gcc/x86_64-pc-linux-gnu/5.3.0/include/g++-v5/algorithm:62,
from /usr/include/qt5/QtCore/qglobal.h:85,
from /usr/include/qt5/QtCore/qnamespace.h:37,
from /usr/include/qt5/QtCore/qobjectdefs.h:41,
from /usr/include/qt5/QtCore/qobject.h:40,
from /usr/include/qt5/QtCore/QObject:1,
from ./modifiedQObject.h:44,
from ./mostQtHeaders.h:12,
from pdfviewer/PDFDocument.h:28,
from pdfviewer/PDFDocument.cpp:24:
/usr/lib/gcc/x86_64-pc-linux-gnu/5.3.0/include/g++-v5/cmath:641:5: note: ‘std::isnan’
isnan(_Tp __x)
^
pdfviewer/PDFDocument.cpp:975:19: error: ‘isnan’ was not declared in this scope
if (!isnan(xinpdf))
Original gentoo bug report:
https://bugs.gentoo.org/show_bug.cgi?id=581520
well, isnan is taken from math.h, which is included in the code.
It compiles fine everywhere (see https://build.opensuse.org/package/show/home:jsundermeyer/)
So I would say, the ball is on your side of the field...
Happens under Kubuntu 16.04 as well.
This is a collision between math.h and cmath imported from these dependencies:
@Jan, Benito: Do you see any problems if we switch from math.h to cmath and use
std::isnan?It is not an issue on my side. Just open the cmath header and find "#undef isnan".
As you can see on the compiler output (comes from gcc-4.9.3, btw.) "random" includes cmath, random get's included by indirectly by Qt. And that finally #undefs everything from math.h which leads to this issue.
I tried to move the math.h include to the end of the includes which did NOT fix this issue. As this is a c++-project the proper solution of course is to use the corresponding c++-header, which is <cmath>.</cmath>
fixed: hg 5998 (91a3b80d1379)
It is rather a mystery that cmath works, as isnan is officially only supported with c++11, which I doubt is already activated with Centos-6, but it compiles ...
Furthmore math.h is perfectly fine, so why it does not work any more on gentoo and kubuntu 16.04, but with lubuntu&ubuntu 16.04 is rather strange.
As suggested by Benito, It would probably be the safest option not to use cmath or math.h at all but resort to Qt functions whenever possible.
-> hg 5999 (5b16f01c3b60)
Last edit: Tim Hoffmann 2016-05-01
Does not compile with Qt4.
I would suggest to go back to the cmath solution as that compiles on all our supported linux platforms as tested on OBS.
@Jan: Please try the latest commit. I think it should work that way (though I cannot test because I don't have Qt4 installed). If not, we'll go back to cmath.
I fixed the remaining bugs