[vtkusers] linking problems

Matt Valerio m-valerio at onu.edu
Mon Jul 12 08:44:13 EDT 2004


I believe you need to specify the libraries on the command line with the 
-l option.  Like this:

g++ -o Medical1.exe Medical1.cxx -I/usr/include/vtk -Wno-deprecated 
-L/usr/lib/vtk -lvtkCommon -lvtkexpat -lvtkFiltering -lvtkfreetype 
-lvtkftgl -lvtkGraphics -lvtkImaging -lvtkIO -lvtkjpeg -lvtkpng 
-lvtkRendering -lvtktiff -lvtkzlib

You probably won't need all of the libraries, but I put them in the 
command line to cover all the bases.

Note that if you have a file like libvtkCommon.so, that you need to 
strip off the "lib" and the ".so" parts before appending it to the -l 
argument. :)

HTH,
Matt


Torsten Wirz wrote:

>hi all, 
>
>I´m a newbie user of the VTK library and have problems by linking the  
>Medical1.cxx test programm with the g++ compiler. 
>
>g++ -I/usr/include/vtk -L/usr/lib/vtk  Medical1.cxx
>
>The compilation is no problem, but when he starts linking the following errors 
>occure:
>
>/tmp/cc0mHzj4.o(.text+0x6c): In function `main':
>: undefined reference to `vtkRenderer::New()'
>------- snip -----------
>
>these message for each vtk-memberfunktion.
>
>I´m using Suse Linux 8.1 and the dynamic libraries are available:
>
>gdpc27:/home/wirz #  ldconfig -p | grep vtk
>        libvtkzlib.so (libc6) => /usr/lib/vtk/libvtkzlib.so
>        libvtktiff.so (libc6) => /usr/lib/vtk/libvtktiff.so
>        libvtkpng.so (libc6) => /usr/lib/vtk/libvtkpng.so
>        libvtkjpeg.so (libc6) => /usr/lib/vtk/libvtkjpeg.so
>        libvtkftgl.so (libc6) => /usr/lib/vtk/libvtkftgl.so
>        libvtkfreetype.so (libc6) => /usr/lib/vtk/libvtkfreetype.so
>        libvtkexpat.so (libc6) => /usr/lib/vtk/libvtkexpat.so
>------- snip ------------
>
>I don´t now why the linker can not find libraries. Does anybody have an idea?
>
>thanx all in advance 
>
>best regards
>
>Torsten
>  
>



More information about the vtkusers mailing list