[vtkusers] Error Compiling Sample Code

Kevin H. Hobbs hobbsk at ohiou.edu
Tue May 22 16:04:28 EDT 2007


On Tue, 2007-05-22 at 14:08 -0400, Ashivni Shekhawat wrote:
> Hi!
>     I am new to vtk and to graphics and rendering.
> I have installed vkt 5.0.3. When I try to compile the example code for
> creating a sphere http://vtk.org/example-code.php I get the errors
> appended. While it is apparent that I am not linking to the required
> libraries, I could not find information on which libraries to link to
> and how. Any suggestions?
> 
> Thanks in advance
> -Ashivni.
> 

I usually just use locate. This works because usually the name of the
directory in which a VTK file is found is the name of the library that
holds it as well.

> try.cpp:(.text+0x84): undefined reference to `vtkSphereSource::New()'

locate tells me that vtkSphereSource.h is in the VTK/Graphics/ directory
so I add vtkGraphics to my TARGET_LINK_LIBRARIES in my CMakeLists.txt. I
think you can just -lvtkGraphics as well. 

> try.cpp:(.text+0xde): undefined reference to `vtkPolyDataMapper::New()'

vtkPolyDataMapper.h is in VTK/Rendering/ so I link against vtkRendering.
I always link against vtkCommon.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070522/31491f2c/attachment.pgp>


More information about the vtkusers mailing list