[ITK-users] C++11?

Becksfort, Jared Jared.Becksfort at STJUDE.ORG
Tue Apr 15 19:06:25 EDT 2014


As usual, when I have an unusual problem it is because I have done something dumb.  In an earlier attempt to fix this, I mistakenly added an ADD_DEFINITION clause containing –std=c++11 to the main CMakeLists.txt file.  This flag was then being inserted in places it wasn’t supposed to be, such as C_FLAGS.  Because I was only deleting build directory, this problem remained.  It appears to build fine now.

Thanks for all the help!

From: Jean-Christophe Fillion-Robin [mailto:jchris.fillionr at kitware.com]
Sent: Tuesday, April 15, 2014 5:41 PM
To: Becksfort, Jared
Cc: Bradley Lowekamp; insight-users at itk.org; Johnson, Hans J
Subject: Re: [ITK-users] C++11?

Hi,

The environment variables that should be set are:
CC
CXX
CFLAGS
CXXFLAGS
For reference, see the following links:

https://github.com/Kitware/CMake/blob/593b69c9dc9e692b198f1ddbf9251130e61a4679/Modules/CMakeDetermineCCompiler.cmake#L51
https://github.com/Kitware/CMake/blob/593b69c9dc9e692b198f1ddbf9251130e61a4679/Modules/CMakeDetermineCXXCompiler.cmake#L50
https://github.com/Kitware/CMake/blob/8472ef243ffc9988ea8fb83cbc7acdf3f0daa239/Modules/CMakeCInformation.cmake#L105
https://github.com/Kitware/CMake/blob/8472ef243ffc9988ea8fb83cbc7acdf3f0daa239/Modules/CMakeCXXInformation.cmake#L20

On Tue, Apr 15, 2014 at 6:26 PM, Becksfort, Jared <Jared.Becksfort at stjude.org<mailto:Jared.Becksfort at stjude.org>> wrote:
From earlier email, I think there is in fact a problem with the flags for
the C compiler:

I have attached the version generated by ccmake for this file:

Modules/ThirdParty/KWSys/src/KWSys/CMakeFiles/itksys.dir/flags.make

Note it has a -std=c++11 in the C flags.  Any thoughts on why it's there
and how to remove it?

I don't have C_FLAGS set anywhere, and it doesn't appear in the ccmake
screen (although neither does my CXX_FLAGS and it shows up, so who knows).

Thanks again,
Jared

On 4/15/14 5:03 PM, "Becksfort, Jared" <Jared.Becksfort at STJUDE.ORG<mailto:Jared.Becksfort at STJUDE.ORG>> wrote:

>Thank you Brad and Hans for replying.  Unfortunately I am still having
>problems. Two things I think are odd are that
>
>- ccmake finds my CXX environment variable but not my CXX_FLAGS, according
>to the curses window.
>- It seems like the error I am getting is that it is trying to add
>-std=c++11 to the compilation of a C file.
>
>I remove the bin/* directory between each attempt, so I doubt it is a
>caching problem.
>
>L130723:bin jbecksfo$ echo $CXX
>/usr/bin/clang++               ### this value shows up in the ccmake configuration
>window
>L130723:bin jbecksfo$ echo $CXX_FLAGS
>-std=c++11 -stdlib=libc++      ### this value does not show up in the ccmake
>configuration window
>
>
>I then run make (which I *think* I am supposed to do) and the error I get
>happens whether I use cmake with arguments or ccmake:
>
>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
>
>I can attach files if that would help.  I appreciate very much whatever
>information you can provide.
>
>Thanks,
>Jared
>
>
>
>
>
>On 4/14/14 10:31 AM, "Bradley Lowekamp" <blowekamp at mail.nih.gov<mailto:blowekamp at mail.nih.gov>> wrote:
>
>>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<mailto: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<mailto: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<http://www.stjude.org/emaildisclaimer>
>>>> Consultation Disclaimer:  www.stjude.org/consultationdisclaimer<http://www.stjude.org/consultationdisclaimer>
>>>>
>>>> _____________________________________
>>>> Powered by www.kitware.com<http://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<http://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
>>
>>
>

_____________________________________
Powered by www.kitware.com<http://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



--
+1 919 869 8849
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20140415/842b341d/attachment.html>


More information about the Insight-users mailing list