[vtk-developers] New build error in 64 bits

Mathieu Coursolle mcoursolle at rogue-research.com
Mon Jun 18 14:12:52 EDT 2007


Hi VTK developpers,

When building my 64 bits version of VTK, I encounter a new build error.

The error is caused by a recent change in VTK:
<http://public.kitware.com/cgi-bin/viewcvs.cgi/IO/vtkDataReader.cxx?
r1=1.143&r2=1.144>

Line 1167 and 1187:
vtkTypeInt64 *ptr = ((vtkTypeInt64Array *)array)-
>WritePointer(0,numTuples*numComp);
vtkTypeUInt64 *ptr = ((vtkTypeUInt64Array *)array)-
>WritePointer(0,numTuples*numComp);

vtkTypeInt64 is either defined as a long or a long long according to
VTK_USE_LONG_LONG.
(See vtkType.h (end of email)).

However, vtkTypeInt64Array is a subclass of vtkLongLongArray, causing a
type mismatch error
when vtkTypeInt64 is of type long. Even if they are both 8 bytes, their
type is different and
the compiler can not do the conversion.

Should WritePointer be overloaded in vtkTypeInt64Array to make sure the
return type is the
expected one?

Thank you.

Mathieu


/* Select a 64-bit integer type.  */
#if VTK_SIZEOF_LONG == 8
typedef unsigned long vtkTypeUInt64;
typedef signed long   vtkTypeInt64;
# define VTK_TYPE_UINT64 VTK_UNSIGNED_LONG
# define VTK_TYPE_INT64 VTK_LONG
#elif defined(VTK_TYPE_USE_LONG_LONG) && VTK_SIZEOF_LONG_LONG == 8
typedef unsigned long long vtkTypeUInt64;
typedef signed long long   vtkTypeInt64;
# define VTK_TYPE_UINT64 VTK_UNSIGNED_LONG_LONG
# define VTK_TYPE_INT64 VTK_LONG_LONG
#elif defined(VTK_TYPE_USE___INT64) && VTK_SIZEOF___INT64 == 8
typedef unsigned __int64 vtkTypeUInt64;
typedef signed __int64   vtkTypeInt64;
# define VTK_TYPE_UINT64 VTK_UNSIGNED___INT64
# define VTK_TYPE_INT64 VTK___INT64
#else
# error "No native data type can represent a 64-bit integer."
#endif

-- 
____________________________________________________________
Mathieu Coursolle                   mcoursolle at rogue-research.com
Rogue Research                      www.rogue-research.com 
Montréal, Québec, Canada




More information about the vtk-developers mailing list