[vtkusers] VTK linking problem

Christos Panagiotou cpanagio at cs.ucl.ac.uk
Wed Jul 2 18:32:28 EDT 2003


hi all

does anybody uses KDevelop and VTK?
if yes please could you please tell me which .h and lib files should I 
link with the compiler
and how:

c++ compiler clags (CXXFLAGS):  under project options->compiler options 
->flags and warnings->CXXFLAGS

currently I am using:
-I/home/christos/VIVE02/vtk/VTK-4.2.2/vtkBin
 -I/home/christos/VIVE02/vtk/VTK-4.2.2/Common
 -I/home/christos/VIVE02/vtk/VTK-4.2.2/Filtering
 -I/home/christos/VIVE02/vtk/VTK-4.2.2/Graphics
 -I/home/christos/VIVE02/vtk/VTK-4.2.2/Hybrid
 -I/home/christos/VIVE02/vtk/VTK-4.2.2/Imaging
 -I/home/christos/VIVE02/vtk/VTK-4.2.2/IO
-I/home/christos/VIVE02/vtk/VTK-4.2.2/Parallel
 -I/home/christos/VIVE02/vtk/VTK-4.2.2/Patented
 -I/home/christos/VIVE02/vtk/VTK-4.2.2/Rendering
 -L/home/christos/VIVE02/vtk/VTK-4.2.2/vtkBin/lib
-Wno-deprecated

I ve also installed the rpm version and tried -I/usr/include/vtk 
-L/usr/lib/vtk

I am getting these undefined errors:


/home/christos/VIVE02/project/asm_3d/asm_3d/main.cpp:44: undefined 
reference to `vtkPoints::New()'
main.o(.text+0x9b):/home/christos/VIVE02/project/asm_3d/asm_3d/main.cpp:51: 
undefined reference to `vtkQuad::New()'
main.o(.text+0x10f):/home/christos/VIVE02/project/asm_3d/asm_3d/main.cpp:57: 
undefined reference to `vtkUnstructuredGrid::New()'
main.o(.text+0x167):/home/christos/VIVE02/project/asm_3d/asm_3d/main.cpp:61: 
undefined reference to `vtkUnstructuredGrid::InsertNextCell(int, 
vtkIdList*)'
collect2: ld returned 1 exit status

and I dont know what else to try and get rid of them

the weird think is that if i write
vtkPoints something;  //it works
vtkPoints forNothing = vtkPoints::New(); // it doesn't
and:
vtkUnstructuredGrid->Allocate(x,y); //works
vtkUnstructuredGrid->InsertNextCell(foo,bar); //returned undefined 
method, collect2: ld returned 1 exit status.
both are in the same .h file, why is this happening...

I would be greatfull for somehelp for setting up vtk with kdevelop
thanks very much


This post follows a message I posted yesterday:

************************************************************
************************************************************


Message: 9
Date: Wed, 02 Jul 2003 06:24:26 +0100
From: Christos Panagiotou <cpanagio at cs.ucl.ac.uk>
To: vtkusers at vtk.org
Subject: [vtkusers] HELP! VTK & LINUX

guys is there any problem with vtk linking in linux?

I installed the rpm nightly release as I thought i did something wrong 
in the compilation of the src files (which I had the same problem that I 
have with the rpm build). All headers were placed in /usr/include/vtk. I 
linked the complier (I use KDevelop) to include this directory (-I 
/usr/include/vtk) and I STILL have errors about _undefined methods._
I try to compile and run the sphere example shown in 
http://www.vtk.org/example-code.php (which is supposed to show 
functionality of VTK and I assume its tested) however I get all these 
errors:

/bin/sh ../libtool --silent --mode=link --tag=CXX g++ -Wnon-virtual-dtor 
-Wno-long-long -Wundef -Wall -pedantic -W -Wpointer-arith 
-Wmissing-prototypes -Wwrite-strings -ansi -D_XOPEN_SOURCE=500 
-D_BSD_SOURCE -Wcast-align -Wconversion -O2 -O0 -g3 -Wall -I 
/usr/include/vtk -fno-exceptions -fno-check-new -o asm_3d main.o 
./Globals/Functions/libFunctions.a


main.o(.text+0x11): In function `main':
/home/christos/VIVE02/project/asm_3d/asm_3d/main.cpp:43: undefined 
reference to `vtkPolyData::New()'
main.o(.text+0x19):/home/christos/VIVE02/project/asm_3d/asm_3d/main.cpp:44: 
undefined reference to `vtkPoints::New()'
main.o(.text+0x21):/home/christos/VIVE02/project/asm_3d/asm_3d/main.cpp:45: 
undefined reference to `vtkCellArray::New()'
main.o(.text+0x29):/home/christos/VIVE02/project/asm_3d/asm_3d/main.cpp:46: 
undefined reference to `vtkFloatArray::New()'
main.o(.text+0xbe):/home/christos/VIVE02/project/asm_3d/asm_3d/main.cpp:51: 
undefined reference to `vtkDataArray::InsertTuple1(int, float)'
main.o(.text+0x105):/home/christos/VIVE02/project/asm_3d/asm_3d/main.cpp:56: 
undefined reference to `vtkPolyData::SetPolys(vtkCellArray*)'
main.o(.text+0x134):/home/christos/VIVE02/project/asm_3d/asm_3d/main.cpp:58: 
undefined reference to `vtkDataSetAttributes::SetScalars(vtkDataArray*)'
main.o(.text+0x151):/home/christos/VIVE02/project/asm_3d/asm_3d/main.cpp:62: 
undefined reference to `vtkPolyDataMapper::New()'
main.o(.text+0x162):/home/christos/VIVE02/project/asm_3d/asm_3d/main.cpp:63: 
undefined reference to `vtkPolyDataMapper::SetInput(vtkPolyData*)'
main.o(.text+0x188):/home/christos/VIVE02/project/asm_3d/asm_3d/main.cpp:65: 
undefined reference to `vtkActor::New()'
main.o(.text+0x1aa):/home/christos/VIVE02/project/asm_3d/asm_3d/main.cpp:69: 
undefined reference to `vtkCamera::New()'
main.o(.text+0x1cd):/home/christos/VIVE02/project/asm_3d/asm_3d/main.cpp:70: 
undefined reference to `vtkCamera::SetPosition(double, double, double)'
main.o(.text+0x1e7):/home/christos/VIVE02/project/asm_3d/asm_3d/main.cpp:71: 
undefined reference to `vtkCamera::SetFocalPoint(double, double, double)'
main.o(.text+0x1ef):/home/christos/VIVE02/project/asm_3d/asm_3d/main.cpp:73: 
undefined reference to `vtkRenderer::New()'
main.o(.text+0x1f7):/home/christos/VIVE02/project/asm_3d/asm_3d/main.cpp:74: 
undefined reference to `vtkRenderWindow::New()'
main.o(.text+0x219):/home/christos/VIVE02/project/asm_3d/asm_3d/main.cpp:77: 
undefined reference to `vtkRenderWindowInteractor::New()'
main.o(.text+0x22a):/home/christos/VIVE02/project/asm_3d/asm_3d/main.cpp:78: 
undefined reference to 
`vtkRenderWindowInteractor::SetRenderWindow(vtkRenderWindow*)'
main.o(.text+0x24c):/home/christos/VIVE02/project/asm_3d/asm_3d/main.cpp:81: 
undefined reference to `vtkRenderer::SetActiveCamera(vtkCamera*)'
main.o(.text+0x25a):/home/christos/VIVE02/project/asm_3d/asm_3d/main.cpp:82: 
undefined reference to `vtkRenderer::ResetCamera()'
main.o(.gnu.linkonce.t._ZN11vtkRenderer8AddActorEP7vtkProp+0x10): In 
function `vtkRenderer::AddActor(vtkProp*)':
/home/christos/VIVE02/project/asm_3d/asm_3d/main.cpp:43: undefined 
reference to `vtkViewport::AddProp(vtkProp*)'
main.o(.gnu.linkonce.t._ZN14vtkIdTypeArray12WritePointerEii+0x24): In 
function `vtkIdTypeArray::WritePointer(int, int)':
/home/christos/VIVE02/project/asm_3d/asm_3d/main.cpp:45: undefined 
reference to `vtkIdTypeArray::ResizeAndExtend(int)'
collect2: ld returned 1 exit status
gmake[3]: *** [asm_3d] Error 1
gmake[3]: Leaving directory `/home/christos/VIVE02/project/asm_3d/asm_3d'
gmake[2]: *** [all-recursive] Error 1
gmake[2]: Leaving directory `/home/christos/VIVE02/project/asm_3d/asm_3d'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/home/christos/VIVE02/project/asm_3d'
gmake: *** [all] Error 2
*** failed ***


I saw also this msg posted in a bulleting board:


  GCC "Name Mangling" Prevent from Linking?

(http://gcc.gnu.org/ml/gcc-help/2002-04/msg00124.html)

Please anyone know something about this please email me

I would be greatfull for any replies
cheers
christos

************************************************************
************************************************************

any help would be appreciated

thanks






More information about the vtkusers mailing list