[vtkusers] 'Undefined Reference' while compiling?

Charl P. Botha c.p.botha at its.tudelft.nl
Wed Aug 28 09:00:05 EDT 2002


Hello Bert,

I hope the book helped. :)

On Wed, Aug 28, 2002 at 12:41:23PM +0000, Bert VanSesamstraat wrote:
> I wanted to try out the c++ examples shipped with vtk.
> Therefore I used the following script:
> 
> VTK_PATH=/usr/include/vtk
> VTK_PATH_LIB=/usr/lib/vtk/tcl
> 
> g++ -I$VTK_PATH -I$VTK_PATH/Common -I$VTK_PATH/Filtering \
> -I$VTK_PATH/Graphics -I$VTK_PATH/Hybrid -I$VTK_PATH/IO \
> -I/usr/X11R6/LessTif/Motif1.2/include -I$VTK_PATH/Imaging 
> -I$VTK_PATH/Patented \
> -I$VTK_PATH/Rendering -I/usr/X11R6/include/X11 \
> -L$VTK_PATH_LIB -I$VTK_PATH_LIB/vtkcommon -I$VTK_PATH_LIB/lvtkfiltering 
> -I$VTK_PATH_LIB/vtkgraphics \
> -I$VTK_PATH_LIB/vtkhybrid -I$VTK_PATH_LIB/vtkiO -I$VTK_PATH_LIB/vtkimaging 
> -I$VTK_PATH_LIB/vtkpatented -I$VTK_PATH_LIB/vtkrendering \
> cpp/Example1.cxx -o Example1 -O2 -g
> 
> When I execute this script i run into a lot of 'undefined references'.
> Can someone tell me what I'm doing wrong?

Your script is not actually linking the example with _any_ libraries, so you
should expect numerous undefined references.  You could modify your script
to link with the built VTK libraries, but it is far easier to run ccmake
e.g. in VTK/Examples/GUI/Motif (where Example1.cxx lives) and have it
generate a good Makefile.  "make Example1" will then do the trick.

I can't remember if this applies to the VTK4.0 release as well.

Good luck,
Charl

-- 
charl p. botha http://cpbotha.net/ http://visualisation.tudelft.nl/



More information about the vtkusers mailing list