[vtkusers] Newbie VTK/C++ question
tom fogal
tfogal at apollo.sr.unh.edu
Wed Jun 2 10:47:27 EDT 2004
<1086183451.382090 at seven.kulnet.kuleuven.ac.be>kitware-vtk at kulnet.kuleuven.ac.
be writes:
<snip>
>The result of this, is a set of binaries in the $VTK/bin directory.
>I copied all header (.h) files and library (.a) files to respectively
>$VTK/include and $VTK/lib.
>I don't know wheter this is important but in cmake I've choosen static
>linking.
copied? do you mean manually?
there is a 'make install' target that should create and copy things to places
where VTK will expect them.
Try putting the 'Cone.o' part of your compile before all the libraries (-lGL,
-lGLU, lvtkCommon, etc). I believe g++ uses the libraries to resolve undefined
references only for objects/libraries that come before the defined reference.
So, for example, if there were undefined references in vtkIO they could be
resolved in vtkGraphics, but not the other way around (using your command line,
below).
HTH,
-tom
>2 - Compilation of application
>
>I use one of the examples to test my VTK setup. I compile it using
> g++ -c -I/tmp/VTK/include Cone.cxx
>This completes succesfully. However when I try to link it using
> g++ -o Cone -I/tmp/VTK/include -L/tmp/VTK/lib -lGL -lGLU -lvtkCommon
>-lvtkIO -lvtkGraphics -lvtkRendering -lvtkFiltering Cone.o
>I get the following error:
> Cone.o: In function `main':
> Cone.o(.text+0x8): undefined reference to `vtkConeSource::New(void)'
> Cone.o(.text+0x70): undefined reference to `vtkPolyDataMapper::New(void
>)'
> Cone.o(.text+0x84): undefined reference to
>`vtkPolyDataSource::GetOutput(void)'
> Cone.o(.text+0x93): undefined reference to
>`vtkPolyDataMapper::SetInput(vtkPolyData *)'
> Cone.o(.text+0x9b): undefined reference to `vtkActor::New(void)'
> Cone.o(.text+0xc2): undefined reference to `vtkRenderer::New(void)'
> Cone.o(.text+0xd7): undefined reference to
>`vtkRenderer::AddActor(vtkProp *)'
> Cone.o(.text+0x117): undefined reference to `vtkRenderWindow::New(void)
>'
> Cone.o(.text+0x19b): undefined reference to
>`vtkRenderer::GetActiveCamera(void)'
> Cone.o(.text+0x1a6): undefined reference to `vtkCamera::Azimuth(double)
>'
> collect2: ld returned 1 exit status
More information about the vtkusers
mailing list