[vtkusers] errors while trying to compile my first example

Lisa Avila lisa.avila at kitware.com
Tue Sep 30 15:54:37 EDT 2003


Hello,

It looks like this code is old - you now must include a header file for 
every class that you use (since VTK itself was "cleaned" to remove 
unnecessary includes from all header files).

Lisa

At 03:23 PM 9/30/2003, bcc at informatik.uni-bremen.de wrote:
>Hello all,
>
>i'm trying to start useing VTK, I am useing Debian/testing as my development
>platform and i installed the VTK with apt-get. i also installed the docs and
>data and dev packages. I am trying to run the sphere test program that i found
>on vtk.org.
>
>Program:
>
>#include "/usr/include/vtk/vtkSphereSource.h"
>#include "/usr/include/vtk/vtkPolyDataMapper.h"
>#include "/usr/include/vtk/vtkActor.h"
>#include "/usr/include/vtk/vtkRenderWindow.h"
>#include "/usr/include/vtk/vtkRenderer.h"
>#include "/usr/include/vtk/vtkRenderWindowInteractor.h"
>
>void main ()
>{
>
>           // create sphere geometry
>           vtkSphereSource *sphere = vtkSphereSource::New();
>           sphere->SetRadius(1.0);
>           sphere->SetThetaResolution(18);
>           sphere->SetPhiResolution(18);
>           // map to graphics library
>           vtkPolyDataMapper *map = vtkPolyDataMapper::New();
>           map->SetInput(sphere->GetOutput());
>           //
>           // actor coordinates geometry, properties, transformation
>           vtkActor *aSphere = vtkActor::New();
>           aSphere->SetMapper(map);
>           aSphere->GetProperty()->SetColor(0,0,1); // sphere color blue
>           //
>           // a renderer and render window
>           vtkRenderer *ren1 = vtkRenderer::New();
>           vtkRenderWindow *renWin = vtkRenderWindow::New();
>           renWin->AddRenderer(ren1);
>           //
>           // an interactor
>           vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
>           iren->SetRenderWindow(renWin);
>           // add the actor to the scene
>           ren1->AddActor(aSphere);
>           ren1->SetBackground(1,1,1); // Background color white
>           // render an image (lights and cameras are created automatically)
>           renWin->Render();
>           //
>           // begin mouse interaction
>           iren->Start();
>}
>End Program
>
>The only thing i changed was to the paths in the include statements so the
>headers could be found. I get an error that says:
>
>Error:
>barsoom:~$ g++ vtkTest2.cpp
>vtkTest2.cpp: In function `int main(...)':
>vtkTest2.cpp:23: invalid use of undefined type `class vtkProperty'
>/usr/include/vtk/vtkActor.h:42: forward declaration of `class vtkProperty'
>End Error.
>
>I am using g++ 2.95 and thought that maybe it had something to do the 
>version of
>g++ that i am using, so i tried with g++-3.2 and i got a lot of warnings and
>basically the same errors except that instead of 'class vtkProperty' i got
>'struct vtkProperty'.
>
>Any know what the problem could be?
>
>Thanks, B
>
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at: 
><http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers






More information about the vtkusers mailing list