[Insight-users] ITK4 VCL Compilation with Visual studio 2011 Developer Preview, VC11

Matt McCormick matt.mccormick at kitware.com
Sat Dec 10 14:15:56 EST 2011


Hi Jan,

Great detective work, and thank you for the patch.  I've started
review of the patch sets.

Thanks,
Matt

On Sat, Dec 10, 2011 at 1:16 PM, Jan Margeta <jmargeta at gmail.com> wrote:
> Hi Matt,
>
> Thanks a lot for your reply. I am now quite convinced that the xkeycheck.h
> file is used solely
> by the C++ preprocessor which tests if any of the reserved words were
> redefined.
>
> the failing part of xkeycheck.h looks like this:
>
> #if defined(alignas)    /* check C++ keywords */ \
>     || defined(alignof) \
>     || defined(asm) \
>     || defined(auto) \
>     || defined(bool) \
>     ....
>     || defined(enum) \
>     || defined(explicit) \
>     || defined(export) \
>     || defined(extern) \
>     ...
>     || defined(friend) \
>     ...
>     || defined(while)
>
>    #error keyword defined before including C++ standard header
>   #endif /* defined... */
>
>
> After a bit of bisectionning of the list (of 72 items), I found the culprit.
>
> Despite the failure of (in
> ....\ITK\src\Modules\ThirdParty\VNL\src\vxl\config\cmake\config\CMakeLists.txt
> line 53)
> PERFORM_CMAKE_TEST(vxl_platform_tests.cxx VCL_HAS_EXPORT)
>
> it is keyword "export" that the preprocessor protects (see vcl_compiler.h
> line 283):
>
> // if the compiler doesn't understand "export", we just leave it out.
> // gcc and SunPro 5.0 understand it, but they ignore it noisily.
> #if
> !VCL_HAS_EXPORT||defined(VCL_EGCS)||defined(VCL_GCC_295)||defined(VCL_GCC_3)||defined(VCL_GCC_4)||defined(VCL_SUNPRO_CC_5)
> # define export /* ignore */
> #endif
>
>
> A dirty hack that worked for me was to change the definition to "__export"
> #if
> !VCL_HAS_EXPORT||defined(VCL_EGCS)||defined(VCL_GCC_295)||defined(VCL_GCC_3)||defined(VCL_GCC_4)||defined(VCL_SUNPRO_CC_5)
> # define __export /* ignore */
> #endif
> #if VCL_HAS_EXPORT
> # define __export export
> #endif
>
> and replace all used exports by __export in
> ...\ITK\src\Modules\ThirdParty\VNL\src\vxl\core\vnl\vnl_diag_matrix.h
> ...\ITK\src\Modules\ThirdParty\VNL\src\vxl\core\vnl\vnl_diag_matrix_fixed.h
> ...\ITK\src\Modules\ThirdParty\VNL\src\vxl\core\vnl\vnl_sym_matrix.h
>
> Here you can find the proposed patches that helped me to compile ITK4 with
> VC11:
> http://review.source.kitware.com/3478
> http://review.source.kitware.com/3479
>
> Cheers,
>
> Jan
>
>
>
>
>
> On Fri, Dec 9, 2011 at 8:26 PM, Matt McCormick <matt.mccormick at kitware.com>
> wrote:
>>
>> Hi Jan,
>>
>> I do not believe we have any dashboard builds of VC11.
>>
>> Can you please report the content of the file xkeycheck.h around line 124?
>>
>> Thanks,
>> Matt
>>
>> On Fri, Dec 9, 2011 at 8:31 AM, Jan Margeta <jmargeta at gmail.com> wrote:
>> > Hi all ITK users,
>> >
>> > When compiling project itkvcl (amon many others) I get errors from
>> > xkeycheck.h
>> >
>> > ...
>> > 2>C:\Program Files (x86)\Microsoft Visual Studio
>> > 11.0\VC\include\xkeycheck.h(124): fatal error C1189: #error :  keyword
>> > defined before including C++ standard header
>> > 2>  vcl_cmath.cxx
>> > 2>C:\Program Files (x86)\Microsoft Visual Studio
>> > 11.0\VC\include\xkeycheck.h(124): fatal error C1189: #error :  keyword
>> > defined before including C++ standard header
>> > 2>  vcl_cassert.cxx
>> > ...
>> >
>> > From the content of this file, I would guess that some extra #define
>> > redefinition of an existing keyword is used somewhere.
>> > Has anyone tackled this and fully compiled ITK4 on VC11?
>> >
>> > Cheers,
>> >
>> > Jan
>> >
>> >
>> >
>> > _____________________________________
>> > 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.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-users
>> >


More information about the Insight-users mailing list