[Insight-developers] [Vxl-users] Compiling with gcc and c++0x
Brad King
brad.king at kitware.com
Mon Jan 2 13:13:13 EST 2012
On 12/29/2011 11:43 AM, David Doria wrote:
> On Thu, Dec 29, 2011 at 9:38 AM, Amitha Perera <amitha at thepereras.org> wrote:
>> The choice to use or not use the inline float initialization is based on a
>> try-compile
>
> I am using the VXL that ships with ITK. I started from scratch (fresh
> build directory), this time just trying to build ITK itself with the
> -std=gnu++0x flag, and got the same errors.
The try-compile correctly rejects the option for me:
$ mkdir ITK-build && cd ITK-build
$ export CXX=g++ CXXFLAGS=-std=gnu++0x
$ cmake ../ITK -DITK_BUILD_ALL_MODULES=OFF -DBUILD_EXAMPLES=OFF \
-DITKGroup_Core=OFF -DModule_ITKVNL=ON
...
-- Enabled ITKVNL, requested by Module_ITKVNL.
...
-- Performing Test VCL_STATIC_CONST_INIT_FLOAT
-- Performing Test VCL_STATIC_CONST_INIT_FLOAT - Failed
...
$ cat CMakeFiles/CMakeError.log
...
Performing Test VCL_STATIC_CONST_INIT_FLOAT failed with the following output:
/usr/bin/g++ -std=gnu++0x ... -DVCL_STATIC_CONST_INIT_FLOAT ... -c .../vxl_platform_tests.cxx
.../vxl_platform_tests.cxx:266:26: error: 'constexpr' needed for in-class initialization of static data member 'x' of non-integral type
.../vxl_platform_tests.cxx:267:27: error: 'constexpr' needed for in-class initialization of static data member 'y' of non-integral type
.../vxl_platform_tests.cxx: In function 'int main()':
.../vxl_platform_tests.cxx:270:21: error: 'x' is not a member of 'A'
.../vxl_platform_tests.cxx:270:38: error: 'y' is not a member of 'A'
...
$ cat Modules/ThirdParty/VNL/src/vxl/vcl/vcl_config_compiler.h
...
//#define VCL_CAN_STATIC_CONST_INIT_FLOAT 1 /* allowed */
//#define VCL_CAN_STATIC_CONST_INIT_FLOAT 0 /* not allowed */
#ifndef VCL_CAN_STATIC_CONST_INIT_FLOAT
# define VCL_CAN_STATIC_CONST_INIT_FLOAT 0
#endif
...
$ make
...works...
-Brad
More information about the Insight-developers
mailing list