<br><br>On Wed, Dec 10, 2008 at 3:20 PM, Mathieu Malaterre <<a href="mailto:mathieu.malaterre@gmail.com">mathieu.malaterre@gmail.com</a>> wrote:<br>> On Wed, Dec 10, 2008 at 7:06 AM, Shailender Kanwar<br>> <<a href="mailto:shailender.kanwar@gmail.com">shailender.kanwar@gmail.com</a>> wrote:<br>
>> hi all<br>>><br>>> i am a newbie to vtk. I am using vtk 5.2.<br>>> while compiling a QT application using vtk, i keep on getting<br>>> undefined reference error for vtk classes and methods<br>
>><br>>> in my program iam trying only to create a QVTKWidget object<br>>> but i am facing a load of undefined references<br>>><br>>> i have recompiled vtk many times tweaking the build settings in cmake<br>
>> but to no avail<br>>> i even tried using vtk 5.0.4 but the same problem comes there too<br>>> i have tried on both windows and linux but the problem doesnt go away<br>><br>> this is not a problem with VTK, this is a problem in your small application.<br>
><br>>> here is a part of the error message<br>>><br>>> g++ -Wl,-rpath,/usr/local/Trolltech/Qt-4.4.3/lib -o test main.o<br>>> -L/usr/local/Trolltech/Qt-4.4.3/lib -L/usr/local/lib/vtk-5.2 -lQVTK<br>
>> -lvtkCommon -lQtGui -L/usr/local/Trolltech/Qt-4.4.3/lib<br>>> -L/usr/X11R6/lib -pthread -lpng -lSM -lICE -pthread -pthread -lXi<br>>> -lXrender -lXrandr -lfreetype -lfontconfig -lXext -lX11 -lQtCore -lz<br>
>> -lm -pthread -lgthread-2.0 -lglib-2.0 -lrt -ldl -lpthread<br>><br>> You are listing: -L/usr/local/lib/vtk-5.2<br>> but I do not see any vtk libs afterwards. Are you using CMake ? If not<br>> you should.<br>
><br>> Eg.<br>><br>> FIND_PACKAGE(VTK REQUIRED)<br>> INCLUDE(${VTK_USE_FILE})<br>><br>> ADD_EXECUTABLE(myapp main.cxx)<br>> TARGET_LINK_LIBRARIES(myapp vtkRendering ... ) # you may need the vtkqt lib too<br>
><br>> --<br>> Mathieu<br>><br><br><br>Actually I am using qmake I had looked at cmake but the makefiles generated by cmake <br>seemed to be too complex so I didnt use it<br>Is is necessary to use cmake for working with vtk ?<br>
<br><br>>> g++ -Wl,-rpath,/usr/local/Trolltech/Qt-4.4.3/lib -o test main.o<br>>> -L/usr/local/Trolltech/Qt-4.4.3/lib<u> <span style="color: rgb(102, 51, 255);">-L/usr/local/lib/vtk-5.2 -lQVTK</span></u><br>>> -lvtkCommon -lQtGui -L/usr/local/Trolltech/Qt-4.4.3/lib<br>
>> -L/usr/X11R6/lib -pthread -lpng -lSM -lICE -pthread -pthread -lXi<br>>> -lXrender -lXrandr -lfreetype -lfontconfig -lXext -lX11 -lQtCore -lz<br>>> -lm -pthread -lgthread-2.0 -lglib-2.0 -lrt -ldl -lpthread<br>
<br><br>Yes you are right<br>here I have only added libQVTK as adding other vtk libs is only increasing the error list, each vtk library is leading to its own list of undefined reference errors.<br>I have tried adding all the vtk libs but still the problem continues. <br>
Maybe my order of linking the libraries is wrong can you tell me in what order the libs should be linked ?<br><br>shailender<br>