[Insight-developers] Compile error with visual studio 2010

David Cole david.cole at kitware.com
Sat Oct 15 06:51:39 EDT 2011


On Fri, Oct 14, 2011 at 2:51 PM, Ziv Yaniv <zyaniv at childrensnational.org> wrote:
> Hello all,
>
> This is a question for the Cmake gurus.
>
> My local ITK repo was full of junk so I decided to reinstall from scratch.
> My configuration is just ITK and testing. Everything seems to be fine except
> that visual studio is complaining: "error C1128: number of sections exceeded
> object file format limit : compile with /bigobj
> c:\toolkits\itk\src\modules\core\common\include\itkimagetoimagefilter.hxx"
>
> Manually modifying the settings for the ITKImageFilterBaseTestDriver project
> as suggested by the error message solves the problem. Is there some Cmake
> magic that can take care of this?
>
>           thanks
>              Ziv
>
> --
> Ziv Yaniv, PhD.,
> Principal Investigator,
> The Sheikh Zayed Institute for Pediatric Surgical Innovation
> Children's National Medical Center
> 6th Floor Main Hospital, Room M7740
> 111 Michigan Ave., N.W
> Washington, D.C 20010
>
> Phone: 202-476-1288
> email: zyaniv at childrensnational.org
> web: http://isiswiki.georgetown.edu/zivy/
>
> _______________________________________________
> 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
>


There is code in SimpleITK's CMakeLists file that does this:

  if(MSVC)
    # /bigobj is required for windows builds because of the size of
    # some object files (CastImage for instance)
    set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj" )
    set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /bigobj" )
  endif()

You can simply add "/bigobj" to your local build trees'
CMAKE_CXX_FLAGS and CMAKE_C_FLAGS variables if you encounter this
problem.

I don't think it would hurt to add this code to ITK's CMakeLists
file... but I have not fully analyzed it. It may increase the size of
intermediate build products and require more disk space for the build
tree, but I think the final build products, especially for an
optimized Release build, should be identical to what they are without
using the flag.


HTH,
David


More information about the Insight-developers mailing list