[ITK-users] C++11?

Bradley Lowekamp blowekamp at mail.nih.gov
Mon Apr 14 11:31:55 EDT 2014


Hello,

Just to further elaborate, in the cmake configuration you need to add "-std=c++11", to CMAKE_CXX_FLAGS on the command line before the first configuration something like:

cmake -DCMAKE_CXX_FLAGS="-std=c++11" /your/source/ITK

Alternatively you can set the CXX_FLAGS environment variable similarly. Either way this should be  done a new build directory with a clean configuration, not a reconfiguration.

Additionally, project that use this C++11 build of ITK should use the same flag.

Brad

On Apr 13, 2014, at 11:33 AM, Johnson, Hans J <hans-johnson at uiowa.edu> wrote:

> Jared,
> 
> ADD_DEFINTIONS is not intended for compiler flags.  You need to configure
> the build initializing with the C++ flags
> 
> CXX=Œ/usr/bin/clang¹ CXX_FLAGS=³-std=c++11²  ccmake ../ITK
> 
> Hans
> 
> 
> 
> On 4/12/14, 10:41 PM, "Becksfort, Jared" <Jared.Becksfort at STJUDE.ORG>
> wrote:
> 
>> Hello,
>> 
>> I was hoping to build the 4.5.2 with C++11.  Are there instructions for
>> doing so?  I tried adding
>> 
>> ADD_DEFINITIONS(
>>   -std=c++11
>> )
>> 
>> to the CMakeLists.txt file, which felt like a hack and didn't work:
>> 
>> Scanning dependencies of target itksys
>> [ 21%] Building C object
>> Modules/ThirdParty/KWSys/src/KWSys/CMakeFiles/itksys.dir/ProcessUNIX.c.o
>> error: invalid argument '-std=c++11' not allowed with 'C/ObjC'
>> make[2]: ***
>> [Modules/ThirdParty/KWSys/src/KWSys/CMakeFiles/itksys.dir/ProcessUNIX.c.o]
>> Error 1
>> make[1]: ***
>> [Modules/ThirdParty/KWSys/src/KWSys/CMakeFiles/itksys.dir/all] Error 2
>> make: *** [all] Error 2
>> 
>> Thanks,
>> Jared
>> 
>> Email Disclaimer:  www.stjude.org/emaildisclaimer
>> Consultation Disclaimer:  www.stjude.org/consultationdisclaimer
>> 
>> _____________________________________
>> 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://www.itk.org/mailman/listinfo/insight-users
> 
> 
> 
> ________________________________
> 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.
> ________________________________
> _____________________________________
> 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://www.itk.org/mailman/listinfo/insight-users



More information about the Insight-users mailing list