[ITK] Compilation of ITK with python wrapping on VS2017

Timothee Evain tevain at telecom-paristech.fr
Sat May 6 11:20:34 EDT 2017


Hello everyone,

I'm trying to compile ITK 4.11 with python wrapping through VisualStudio 2017.
Build fails because every itk*CastXML and itk*Swig projects trigger a bunch of errors related to the xstring file of visual studio like this:

[...]
Error	G3F63BFAE	constexpr variable '_Memcpy_move_offset' must be initialized by a constant expression	ITKSpatialObjectsCastXML	C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\xstring	1905	
Error	G3F63BFAE	constexpr variable '_Memcpy_move_size' must be initialized by a constant expression	ITKSpatialObjectsCastXML	C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\xstring	1906	
[...]

more detailed as:

4>C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.10.25017/include\xstring(1905,26): error G3F63BFAE: constexpr variable '_Memcpy_move_offset' must be initialized by a constant expression
4>        static constexpr size_t _Memcpy_move_offset = offsetof(_Mydata_t, _Bx);
4>                                ^                     ~~~~~~~~~~~~~~~~~~~~~~~~
4>C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.10.25017/include\stdexcept:23:21: note: in instantiation of template class 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >' requested here
4>                : _Mybase(_Message.c_str())
4>                                  ^
4>C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.10.25017/include\xstring:1905:48: note: cast that performs the conversions of a reinterpret_cast is not allowed in a constant expression
4>        static constexpr size_t _Memcpy_move_offset = offsetof(_Mydata_t, _Bx);
4>                                                      ^
4>C:/Program Files (x86)/Windows Kits/10/Include/10.0.14393.0/ucrt\stddef.h:42:32: note: expanded from macro 'offsetof'
4>        #define offsetof(s,m) ((size_t)&reinterpret_cast<char const volatile&>((((s*)0)->m)))
4>  

4>C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.10.25017/include\xstring(1906,26): error G3F63BFAE: constexpr variable '_Memcpy_move_size' must be initialized by a constant expression
4>        static constexpr size_t _Memcpy_move_size = sizeof(_Mydata_t) - _Memcpy_move_offset;
4>                                ^                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4>C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.10.25017/include\xstring:1906:66: note: initializer of '_Memcpy_move_offset' is not a constant expression
4>        static constexpr size_t _Memcpy_move_size = sizeof(_Mydata_t) - _Memcpy_move_offset;
4>                                                                        ^
4>C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.10.25017/include\xstring:1905:26: note: declared here
4>        static constexpr size_t _Memcpy_move_offset = offsetof(_Mydata_t, _Bx);

Have the python wrapping been tested for compilation with latest standards (constexpr is C++11 if I remember well) ?

Tim


More information about the Community mailing list