[vtkusers] include header file or cast

Paul Tait paul at opes.com.au
Tue Oct 14 04:59:50 EDT 2003


Hi

Thanks for the reply. Just to expand a little

I don't "explicitly" use vtkUnstructuredGrid in my source file so it can be
a bit perplexing getting an error like this. Its like when I tried to pass a
vtkPolyData

mapCellTop->SetInput(polydataTop->GetOutput());   WRONG

then I found out it was

mapCellTop->SetInput(polydataTop);

It just makes it a bit off putting when your learning VTK
So I mess around with a cast or by adding or deleting a GetOutput() till
something compiles. I guess when I know it all, I'll know it all ;-)

Paul



----- Original Message ----- 
From: "Mathieu Malaterre" <Mathieu.Malaterre at creatis.insa-lyon.fr>
To: "Paul Tait" <paul at opes.com.au>
Cc: <vtkusers at vtk.org>
Sent: Tuesday, October 14, 2003 4:27 PM
Subject: Re: [vtkusers] include header file or cast


> 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