[vtkusers] Recursive Make, vtk project --> undefined references!
Obada Mahdi
omahdi at gmx.de
Thu Apr 27 08:32:50 EDT 2006
Hi Peter!
Peter Schmitt wrote:
> I get a series of "undefined reference" errors when linking a
> visualization project I wrote:
>
> visualize.o(.text+0x7): undefined reference to `vtkSphereSource::New(void)'
> [...]
> viz: LDFLAGS=-L$(VTK_HOME)/lib/vtk -lvtkRendering -lvtkGraphics
> -lvtkImaging -lvtkFiltering -lvtkCommon -L./vis -lvis
> What's wrong with my syntax when linking? This code runs fine on one
> system (standard Linux Debian install) but breaks (with the "undefined
> references" link errors) on another system....
Try reordering the library specification, giving "-lvis" before vtk libs.
LDFLAGS=-L./vis -lvis -L$(VTK_HOME)/lib/vtk -lvtkRendering \
-lvtkGraphics -lvtkImaging -lvtkFiltering -lvtkCommon
Many linkers do not remember unreferenced imported symbols while
processing libraries, so the order is important. Any library needed to
resolve a certain symbol must be given after the object file or library
that references it (for circular dependencies, some libraries may have
to be given more than once).
Apparently some newer linkers do not depend on the order any more, so
maybe that is the case with your Debian system.
HTH,
Obada
More information about the vtkusers
mailing list