[Insight-developers] [Vxl-users] Compiling with gcc and c++0x

Williams, Norman K norman-k-williams at uiowa.edu
Wed Jan 4 12:12:34 EST 2012


I have a patch that adds '-Werror=gnu' if CLang++ is the C++ compiler.
This gets rid of all the inline static float initializer errors, but it
also makes necessary a slight change in vnl_lsqr.cxx because CLang defines
__GNUC__, and -Werror=gnu makes all the GNU extensions throw an error.


I don't know if there's any place in ITK besides VXL that uses Gnu
extensions; the places that VXL uses them seem to me to be of dubious and
limited utility, and stink up the source code with #ifdefs.  But that's
just one man's opinion.

On 1/2/12 12:13 PM, "Brad King" <brad.king at kitware.com> wrote:

>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
>_______________________________________________
>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://kitware.com/products/protraining.html
>
>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://www.itk.org/mailman/listinfo/insight-developers



________________________________
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged.  If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited.  Please reply to the sender that you have received the message in error, then delete it.  Thank you.
________________________________


More information about the Insight-developers mailing list