[vtkusers] errors while trying to compile my first example

bcc at informatik.uni-bremen.de bcc at informatik.uni-bremen.de
Tue Sep 30 15:23:13 EDT 2003


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




More information about the vtkusers mailing list