[vtkusers] include header file or cast

Mathieu Malaterre Mathieu.Malaterre at creatis.insa-lyon.fr
Tue Oct 14 04:27:39 EDT 2003


Paul Tait wrote:
> As I'm still learning VTK I find it very disconcerting when I get an error
> such as
> 
> error C2664: 'SetInput' : cannot convert parameter 1 from 'class
> vtkUnstructuredGrid *' to 'class vtkDataSet *'
> 
> After checking the help file I find that vtkUnstructuredGrid is derived from
> vtkDataSet and as they are both pointers it should compile. After a quick
> panic attack thinking I don't know anything about C++ I check the mailing
> list.
> 
>  I've seen casts used but now I'm forcing myself to do what I think is the
> right thing and including
> 
> #include <vtkUnstructuredGrid.h>
> 

Since VTK use forward include you need to include *explictely* all 
classes you are using. So you are perfectly right.

mathieu




More information about the vtkusers mailing list