[vtkusers] VS 2010 64-bit build problems

Fahlgren, Eric eric.fahlgren at smith-nephew.com
Wed Aug 7 15:14:50 EDT 2013


VTK 5.10.1
Windows 7 64 sp1
Microsoft Visual Studio 2010 using 64-bit compilers
CMake 2.8.4

I have built this source base in 32-bit many times, both Release and Debug, used it for months without problems.  Created a new directory, installed same source, configure CMake files for 64-bit (c:\PROGRA~2\MICROS~2.0\VC\BIN\amd64\cl.exe and link.exe), and get a syntax error while compiling Common/vtkAbstractArray.cxx.

vtkAbstractArray.cxx
...
Note: including file: g:\vtk-5.10.1-py27-64\common\vtkCharArray.h
Note: including file:  g:\vtk-5.10.1-py27-64\common\vtkDataArray.h
Note: including file:  g:\vtk-5.10.1-py27-64\common\vtkDataArrayTemplate.h
Note: including file:   g:\vtk-5.10.1-py27-64\common\vtkDataArray.h
Note: including file:   g:\vtk-5.10.1-py27-64\common\vtkDataArrayTemplateImplicit.txx
Note: including file:    g:\vtk-5.10.1-py27-64\common\vtkDataArrayTemplate.txx
Note: including file:     g:\vtk-5.10.1-py27-64\common\vtkDataArrayTemplate.h
g:\vtk-5.10.1-py27-64\common\vtkDataArrayTemplate.h(331) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

Digging deeper, I find that the problem is the inclusion of vtkDataArrayTemplate.h twice, the second time being before VTK_DATA_ARRAY_TEMPLATE_INSTANTIATE is defined, but after VTK_DATA_ARRAY_TEMPLATE_TYPE is defined, so the macro in the tail of the header file is not expanded (using the -E flag on the compiler shows the offending line 331 to be "extern VTK_DATA_ARRAY_TEMPLATE_INSTANTIATE(char);").

So, two solutions present themselves:

1) Swap lines 300 and 301 in vtkDataArrayTemplate.h, so that the include follows the define, i.e., from
   # include "vtkDataArrayTemplateImplicit.txx"
   # define VTK_DATA_ARRAY_TEMPLATE_INSTANTIATE(T) 
   to
   # define VTK_DATA_ARRAY_TEMPLATE_INSTANTIATE(T)
   # include "vtkDataArrayTemplateImplicit.txx"

2) Change the check on line 309 to check a different macro for definition from
   #if defined(VTK_DATA_ARRAY_TEMPLATE_TYPE)
   to 
   #if defined(VTK_DATA_ARRAY_TEMPLATE_INSTANTIATE)

I have currently implemented the second one and am in the middle of my build, but I have no means for evaluating what the impact on this is, and the question remains, why in the world does a 64-bit build re-include the header file differently than the 32-bit build?



More information about the vtkusers mailing list