[vtk-developers] Errors when compiling VTK v6.0.0 in C++11 mode

Kyle Lutz kyle.lutz at kitware.com
Wed Jul 10 11:08:47 EDT 2013


On Wed, Jul 10, 2013 at 10:31 AM, Kevin Funk <kevin.funk at kdab.com> wrote:
> Hey list,
>
> Compiling VTK v6.0.0 with C++11 mode enabled results in the following
> compilation error:
>
> """
> [ 26%] Building CXX object
> Common/Core/CMakeFiles/vtkCommonCore.dir/vtkAbstractArray.cxx.o
> In file included from /home/krf/devel/src/VTK-
> master/Common/Core/vtkAbstractArray.cxx:26:0:
> /home/krf/devel/src/VTK-master/Common/Core/vtkMath.h: In static member
> function 'static int vtkMath::IsInf(double)':
> /home/krf/devel/src/VTK-master/Common/Core/vtkMath.h:1249:18: error: call of
> overloaded 'isinf(double&)' is ambiguous
> /home/krf/devel/src/VTK-master/Common/Core/vtkMath.h:1249:18: note: candidates
> are:
> In file included from /usr/include/math.h:70:0,
>                  from /home/krf/devel/src/VTK-
> master/Common/Core/vtkSetGet.h:30,
>                  from /home/krf/devel/src/VTK-
> master/Common/Core/vtkObject.h:43,
>                  from /home/krf/devel/src/VTK-
> master/Common/Core/vtkAbstractArray.h:45,
>                  from /home/krf/devel/src/VTK-
> master/Common/Core/vtkAbstractArray.cxx:15:
> /usr/include/x86_64-linux-gnu/bits/mathcalls.h:202:12: note: int isinf(double)
> In file included from /home/krf/devel/build/VTK-
> master/Common/Core/vtkMathConfigure.h:24:0,
>                  from /home/krf/devel/src/VTK-master/Common/Core/vtkMath.h:42,
>                  from /home/krf/devel/src/VTK-
> master/Common/Core/vtkAbstractArray.cxx:26:
> /usr/include/c++/4.7/cmath:611:3: note: constexpr bool std::isinf(long double)
> /usr/include/c++/4.7/cmath:607:3: note: constexpr bool std::isinf(double)
> /usr/include/c++/4.7/cmath:603:3: note: constexpr bool std::isinf(float)
> In file included from /home/krf/devel/src/VTK-
> master/Common/Core/vtkAbstractArray.cxx:26:0:
> /home/krf/devel/src/VTK-master/Common/Core/vtkMath.h: In static member
> function 'static int vtkMath::IsNan(double)':
> /home/krf/devel/src/VTK-master/Common/Core/vtkMath.h:1259:18: error: call of
> overloaded 'isnan(double&)' is ambiguous
> /home/krf/devel/src/VTK-master/Common/Core/vtkMath.h:1259:18: note: candidates
> are:
> In file included from /usr/include/math.h:70:0,
>                  from /home/krf/devel/src/VTK-
> master/Common/Core/vtkSetGet.h:30,
>                  from /home/krf/devel/src/VTK-
> master/Common/Core/vtkObject.h:43,
>                  from /home/krf/devel/src/VTK-
> master/Common/Core/vtkAbstractArray.h:45,
>                  from /home/krf/devel/src/VTK-
> master/Common/Core/vtkAbstractArray.cxx:15:
> /usr/include/x86_64-linux-gnu/bits/mathcalls.h:235:12: note: int isnan(double)
> In file included from /home/krf/devel/build/VTK-
> master/Common/Core/vtkMathConfigure.h:24:0,
>                  from /home/krf/devel/src/VTK-master/Common/Core/vtkMath.h:42,
>                  from /home/krf/devel/src/VTK-
> master/Common/Core/vtkAbstractArray.cxx:26:
> /usr/include/c++/4.7/cmath:629:3: note: constexpr bool std::isnan(long double)
> /usr/include/c++/4.7/cmath:625:3: note: constexpr bool std::isnan(double)
> /usr/include/c++/4.7/cmath:621:3: note: constexpr bool std::isnan(float)
> make[2]: *** [Common/Core/CMakeFiles/vtkCommonCore.dir/vtkAbstractArray.cxx.o]
> Error 1
> make[1]: *** [Common/Core/CMakeFiles/vtkCommonCore.dir/all] Error 2
> make: *** [all] Error 2
> makeobj[0]: Leaving directory `/home/krf/devel/build/VTK-master'
> """
>
> Since there are C++11 checks all over the code base I'd assume one can compile
> VTK in C++11 mode.
>
> Is that a known issue? I didn't find a bug report for this one.

Hi Kevin,

This is indeed a bug. Feel free to create an issue on the bug tracker.
Attached is an (untested) patch which should fix the issue. Can you
try it out?

Sean, can you take a look at this?

Thanks,
Kyle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-cpp11-math.diff
Type: application/octet-stream
Size: 909 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20130710/e7e0e29b/attachment-0001.obj>


More information about the vtk-developers mailing list