[ITK] [ITK-users] ITK 4.8.1, OS X 10.10 and C++11 Support

Davis Vigneault davis.vigneault at gmail.com
Fri Oct 30 09:50:26 EDT 2015


Michael--

I'm not sure if this is the same problem, but I once ran into trouble
compiling ITK with c++11 and found that I needed to add the flag during the
*initial* configuration at commandline.  If I added it in the ccmake gui, I
got type traits errors.  Something like this:

$ ccmake ../src -DCMAKE_CXX_FLAGS=-std=c++11

Hope that helps, and best of luck if not.

--Davis

On Fri, Oct 30, 2015 at 12:54 PM, Michael Jackson <
mike.jackson at bluequartz.net> wrote:

> The issue is that I am probably missing something when configuring ITK.
> Looking in my CMake configure logs I have this message:
>
> Run Build Command:"/usr/local/bin/ninja" "cmTC_2927f"
> [1/2] Building CXX object CMakeFiles/cmTC_2927f.dir/CheckIncludeFile.cxx.o
> FAILED:
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
>   -Wall -Wcast-align -Wdisabled-optimization -Wextra -Wformat=2
> -Winvalid-pch -Wno-format-nonliteral -Wpointer-arith -Wshadow -Wunused
> -Wwrite-strings -funit-at-a-time -Wno-strict-overflow -Wno-deprecated
> -Wno-invalid-offsetof -Woverloaded-virtual   -isysroot
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk
> -mmacosx-version-min=10.7 -o
> CMakeFiles/cmTC_2927f.dir/CheckIncludeFile.cxx.o -c CheckIncludeFile.cxx
> CheckIncludeFile.cxx:1:10: fatal error: 'type_traits' file not found
> #include <type_traits>
>          ^
> 1 error generated.
> ninja: build stopped: subcommand failed.
>
> If you take that same command line and file to compile but simply add
> "-std=c++11 -stdlib=libc++” to the command line then the compile succeeds.
> So this is clearly a “user error”. How do I ensure that when CMake is
> running all of its detection tests that those flags get added? Otherwise
> the tests are not really valid for the way I am going to compile the codes.
> I figured by creating an initial CMakeCache.txt file that those flags would
> get added to every “test” but I guess that is not the way to accomplish
> that task.
> --
> Michael A. Jackson
> BlueQuartz Software, LLC
> [e]: mike.jackson at bluequartz.net
>
> > On Oct 29, 2015, at 11:37 PM, Matt McCormick <matt.mccormick at kitware.com>
> wrote:
> >
> > Hi Michael,
> >
> >>> I am getting the following compile error when I compile my codes
> against
> >>> ITK 4.8.1
> >>>
> >>> /Users/Shared/DREAM3D_SDK/InsightToolkit-4.8.1/Modules/Core/Common/
> >>> include/itkImageAlgorithm.h:26:12: fatal error: 'tr1/type_traits' file
> >>> not found
> >>> #  include <tr1/type_traits>
> >>>
> >>> I compiled ITK with C++ 11 support by initializing ITK’s CMake cache
> >>> with the following values:
> >>>
> >>>
> >>> echo "CMAKE_CXX_STANDARD=11" >> $cacheFile
> >>> echo "CMAKE_CXX_STANDARD_REQUIRED:BOOL=ON" >> $cacheFile
> >>> echo “CMAKE_OSX_DEPLOYMENT_TARGET=10.7" >> $cacheFile
> >>> echo "CMAKE_OSX_SYSROOT:Path=$OSX_SDK" >> $cacheFile
> >>> echo "CMAKE_CXX_FLAGS:STRING=-stdlib=libc++ -std=c++11 " >> cacheFile
> >>>
> >>> ITK seemed to compile and install but I only compiled the libraries and
> >>> none of the tests.
> >>>
> >>> Has anyone ever had this issue? And what do I need to do to solve it.
> >
> > Where the same CMake variables used when building your codes?  All
> > these should be consistent throughout all compiled and linked code.
> >
> > Hope this helps,
> > Matt
>
> _____________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20151030/53b2a6cb/attachment.html>
-------------- next part --------------
_____________________________________
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 Community mailing list