[ITK-users] vnl_numeric_traits.h constexpr _aka_ ITK and C++11

Matt McCormick matt.mccormick at kitware.com
Thu Apr 23 16:39:51 EDT 2015


Hi Pol,

Thanks for the update!

Yes, that is the expected behaviour :-).

The flag must be added during the initial call to ccmake before the
first CMake configuration run occurs.  Instead of adding
-DCMAKE_CXX_FLAGS=-std=c++11, another option is to set the CXXFLAGS
environmental variable:

  CXXFLAGS=-stdc++11 ccmake ~/src/ITK

HTH,
Matt

On Thu, Apr 23, 2015 at 11:28 AM, Pol Monsó Purtí <lluna.nova at gmail.com> wrote:
> Hello all,
>
> Thanks Matt, the dependencies were already compiled correctly. Stay put as
> the plot thickens.
>
> I've reproduced the steps that I had done to compile ITK before and it
> worked, so I kept searching for the cause of the error and it boils down to
> this:
>
> If I compile with ccmake, it fails with the mentioned errors.
>
> if I compile with cmake, it works.
>
> In both cases setting the flag CMAKE_CXX_FLAGS to -std=c++11
>
> So my guess is that when running ccmake, the first configure sets the
> headers wrong and that doesn't get fixed when setting the -std=c++11 after
> the first configure is done.
>
> Indeed it doesn't happen with ccmake -DCMAKE_CXX_FLAGS=-std=c++11 . (The ' '
> are apparently unnecessary)
>
> Cheers!
>
> Pol
>
> 2015-04-23 0:19 GMT+02:00 Matt McCormick <matt.mccormick at kitware.com>:
>>
>> Hi Pol,
>>
>> Make sure to build ITK and everything that builds against ITK by
>> specifying the '-std=c++11' flag beginning with the initial CMake
>> configuration from a fresh build. By adding this flag, it is like
>> specifying a different compiler, and there are some initial
>> configuration try_compile tests that extract information about the
>> compiler.  Specify it with
>>
>>   cmake -DCMAKE_CXX_FLAGS='std=c++11' ~/src/ITK
>>
>> HTH,
>> Matt
>>
>> On Wed, Apr 22, 2015 at 5:57 PM, Pol Monsó Purtí <lluna.nova at gmail.com>
>> wrote:
>> > Hello all,
>> >
>> > Today I moved&updated the ITK directory so I had to rebuild everything.
>> > I am
>> > compiling with -std=c++11
>> >
>> > Misteriously, now I am getting the error
>> >
>> >
>> > /Users/monso/code/ITK/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_numeric_traits.h:437:68:
>> > error: 'constexpr' needed for in-class initialization of static data
>> > member
>> > 'const long double vnl_numeric_traits<long double>::maxval' of
>> > non-integral
>> > type [-fpermissive]
>> >    static const long double maxval
>> > VCL_STATIC_CONST_INIT_FLOAT_DECL(1.7976931348623157E+308);
>> >
>> > which apparently it's a bug that was there around 2011. How come it came
>> > back? Any ideas?
>> >
>> > This is using the master branch of
>> > https://github.com/InsightSoftwareConsortium/ITK.git
>> >
>> > See
>> > http://public.kitware.com/pipermail/community/2013-December/004580.html
>> >
>> > I am on OSX, using g++-mp-4.9
>> >
>> > I tried setting the vcl_include_cxx_0x, same result.
>> >
>> > I don't know how I fixed this or if I had the issue (I kind of recall
>> > this),
>> > but it worked before. So I tried with ITK4.7.1 from the website, same
>> > result.
>> >
>> > Cheers,
>> >
>> > Pol
>> >
>> >
>> > _____________________________________
>> > 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 Insight-users mailing list