[ITK] [ITK-users] ITK: error: floating-point literal cannot appear in a constant-expression

Bradley Lowekamp blowekamp at mail.nih.gov
Wed Jul 30 11:56:18 EDT 2014


Nick,

I was a little too specific with the flag to look for in my prior e-mail

The error message you are getting is coming from here[1]. Which used the VECL_STATIC_CONST_INIT_FLOAT_DECL macro defined here[2]. CMake does some try compile to see if this in class declaration of double is supported during your initial configuration when ITK is first built. If it's detected that the compiler supports, then when ever ITK is used this feature is enabled.

Something changed with your compiler, like some addition or removal of flag, which changed the support of the feature.

Hope that helps,
Brad

[1] https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_numeric_traits.h#L387
[2] https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/ThirdParty/VNL/src/vxl/vcl/vcl_config_compiler.h.in#L138-L159

On Jul 30, 2014, at 11:47 AM, Nick Patterson <pattersonnp.work at gmail.com> wrote:

> 
> Dear Brad,
> 
> 	I’m afraid I made no further progress to report on the compilation of my application. It’s very curious. I even tried to roll back to ITK 4.5.2 (rather than the newer 4.6) but I am receiving similar errors. I have no issues with compiling this code on my Macbook… just on my linux box.
> 
> Regards, Nick.
> 
> 
> 
> On 29 Jul 2014, at 22:20, Bradley Lowekamp <blowekamp at mail.nih.gov> wrote:
> 
>> Hello,
>> 
>> Is any of your code monkeying around with the "-std=c++11" flags? Did you compile ITK or your application with it?
>> 
>> Brad
>> 
>> On Jul 29, 2014, at 10:59 AM, Nick Patterson <pattersonnp.work at gmail.com> wrote:
>> 
>>> Hi,
>>>  Can I ask if anybody has the following error when compiling code which makes use of ITK? The complilation of ITK was fine, this is an error produced when compiling against ITK in my own application.
>>> 
>>> The error that I am currently getting is:- (Building on Ubuntu Linux). 
>>> 
>>> 
>>> In file included from /usr/local/include/ITK-4.5/vnl/vnl_c_vector.h:26:0,
>>>                from /usr/local/include/ITK-4.5/vnl/vnl_vector.h:22,
>>>                from /usr/local/include/ITK-4.5/vnl/vnl_vector_ref.h:20,
>>>                from /usr/local/include/ITK-4.5/itkVector.h:23,
>>>                from /usr/local/include/ITK-4.5/itkPoint.h:23,
>>>                from /usr/local/include/ITK-4.5/itkContinuousIndex.h:21,
>>>                from /usr/local/include/ITK-4.5/itkImageRegion.h:34,
>>>                from /usr/local/include/ITK-4.5/itkImageIORegion.h:24,
>>>                from /usr/local/include/ITK-4.5/itkImageIOBase.h:26,
>>>                from /usr/local/include/ITK-4.5/itkImageFileReader.h:22,
>>>                from /usr/local/include/ITK-4.5/itkImageSeriesReader.h:26,
>>>                from /home/nppatt/Raydose2/RaydoseNew/src/Simulation/RaydoseNMImageData.cpp:2:
>>> /usr/local/include/ITK-4.5/vnl/vnl_numeric_traits.h:387:27: error: floating-point literal cannot appear in a constant-expression
>>> /usr/local/include/ITK-4.5/vnl/vnl_numeric_traits.h:387:27: warning: ISO C++ forbids initialization of member constant 'zero' of non-integral type 'const float' [-pedantic]
>>> /usr/local/include/ITK-4.5/vnl/vnl_numeric_traits.h:389:26: error: floating-point literal cannot appear in a constant-expression
>>> /usr/local/include/ITK-4.5/vnl/vnl_numeric_traits.h:389:26: warning: ISO C++ forbids initialization of member constant 'one' of non-integral type 'const float' [-pedantic]
>>> /usr/local/include/ITK-4.5/vnl/vnl_numeric_traits.h:391:29: error: floating-point literal cannot appear in a constant-expression
>>> /usr/local/include/ITK-4.5/vnl/vnl_numeric_traits.h:391:29: warning: ISO C++ forbids initialization of member constant 'maxval' of non-integral type 'const float' [-pedantic]
>>> /usr/local/include/ITK-4.5/vnl/vnl_numeric_traits.h:410:28: error: floating-point literal cannot appear in a constant-expression
>>> /usr/local/include/ITK-4.5/vnl/vnl_numeric_traits.h:410:28: warning: ISO C++ forbids initialization of member constant 'zero' of non-integral type 'const double' [-pedantic]
>>> /usr/local/include/ITK-4.5/vnl/vnl_numeric_traits.h:412:27: error: floating-point literal cannot appear in a constant-expression
>>> /usr/local/include/ITK-4.5/vnl/vnl_numeric_traits.h:412:27: warning: ISO C++ forbids initialization of member constant 'one' of non-integral type 'const double' [-pedantic]
>>> /usr/local/include/ITK-4.5/vnl/vnl_numeric_traits.h:414:30: error: floating-point literal cannot appear in a constant-expression
>>> /usr/local/include/ITK-4.5/vnl/vnl_numeric_traits.h:414:30: warning: ISO C++ forbids initialization of member constant 'maxval' of non-integral type 'const double' [-pedantic]
>>> /usr/local/include/ITK-4.5/vnl/vnl_numeric_traits.h:433:33: error: floating-point literal cannot appear in a constant-expression
>>> /usr/local/include/ITK-4.5/vnl/vnl_numeric_traits.h:433:33: warning: ISO C++ forbids initialization of member constant 'zero' of non-integral type 'const long double' [-pedantic]
>>> /usr/local/include/ITK-4.5/vnl/vnl_numeric_traits.h:435:32: error: floating-point literal cannot appear in a constant-expression
>>> /usr/local/include/ITK-4.5/vnl/vnl_numeric_traits.h:435:32: warning: ISO C++ forbids initialization of member constant 'one' of non-integral type 'const long double' [-pedantic]
>>> /usr/local/include/ITK-4.5/vnl/vnl_numeric_traits.h:437:35: error: floating-point literal cannot appear in a constant-expression
>>> /usr/local/include/ITK-4.5/vnl/vnl_numeric_traits.h:437:35: warning: ISO C++ forbids initialization of member constant 'maxval' of non-integral type 'const long double' [-pedantic]R
>>> 
>>> 
>>> Regards, Nick
>>> _______________________________________________
>>> Community mailing list
>>> Community at itk.org
>>> http://public.kitware.com/mailman/listinfo/community
>> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20140730/aad7b7fc/attachment-0002.html>
-------------- next part --------------
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list