[Insight-users] Re: link problem : Qt + VTK + ITK

Luis Ibanez luis.ibanez@kitware.com
Tue, 11 Feb 2003 20:03:36 -0500


Hi Imho

Your CMakeLists.txt file looks good.

Could you please sent us your
"CMakeCache.txt" file ?

This file is generated by CMake
in your Binary directory.

The generated "Makefile" could also
be useful.

Are you using any VTK+QT external component ?
For example one of the multiple implementations
of Qt windows adapted to be VTK render windows ?

One usual suspect in this case is that you
are by accident building against two different
versions of Qt and/or VTK.


Please let us know about the files above.


   Thanks


     Luis



-------------------------

imho wrote:

> Hi Luis,
> I've definitely problems with cmake under linux.
> Now I've writed a cmakelist file (I've corrected the QT_QT_LIBRARY), the
> cmake works great, but make give me a lot of linking problems (undefined
> reference to... all !! ).
> 
> thanks a lot
> 
> files are following here : 
> 
> 
> Here is my cmakelist : 
> -----------------------------------------------------
> PROJECT(NewProject)
> 
> INCLUDE (${CMAKE_ROOT}/Modules/FindVTK.cmake)
> IF (USE_VTK_FILE)
>   INCLUDE(${USE_VTK_FILE})
> ENDIF (USE_VTK_FILE)
> 
> 
> 
> # 
> # Find ITK
> #
> INCLUDE (${CMAKE_ROOT}/Modules/FindITK.cmake)
> IF (USE_ITK_FILE)
>   INCLUDE(${USE_ITK_FILE})
> ENDIF(USE_ITK_FILE)
> 
> # 
> # Find QT
> #
> INCLUDE (${CMAKE_ROOT}/Modules/FindQt.cmake)
> 
> 
> INCLUDE_DIRECTORIES(
> ${QT_INCLUDE_DIR}
> ${QT_INCLUDE_PATH}
> /home/imho/memoire/VTK
> /home/imho/memoire/VTK/Rendering
> /home/imho/memoire/VTK/Imaging
> /home/imho/memoire/VTK/Graphics
> /home/imho/memoire/VTK/Hybrid
> /home/imho/memoire/VTK/Common
> /home/imho/memoire/VTK/Filtering
> /home/imho/memoire/VTK/IO
> /home/imho/memoire/VTK/Patented
> /home/imho/memoire/VTK/Parallel
> /home/imho/memoire/VTK/Utilities/zlib
> /home/imho/memoire/ITK/InsightToolkit-1.0.0/Code/Algorithms
> /home/imho/memoire/ITK/InsightToolkit-1.0.0/Code/IO
> /home/imho/memoire/ITK/InsightToolkit-1.0.0/Code/BasicFilters
> /home/imho/memoire/ITK/InsightToolkit-1.0.0/Code/Numerics
> /home/imho/memoire/ITK/InsightToolkit-1.0.0/Code/SpatialObject
> /home/imho/memoire/ITK/InsightToolkit-1.0.0/Code/Numerics/vxl
> /home/imho/memoire/ITK/InsightToolkit-1.0.0/Code/Numerics/vxl/vcl
> /home/imho/memoire/ITK/InsightToolkit-1.0.0/Code/Numerics/vxl/vnl
> /home/imho/memoire/ITK/InsightToolkit-1.0.0/Examples/vtkITK/Common
> 
> 
> /usr/local/lib/VTK
> /usr/local/include/VTK
> 
> /usr/local/qt/lib
> 
> 
> )
> 
> LINK_LIBRARIES (
> 
> vtkRendering
> vtkGraphics	  
> vtkHybrid	  
> vtkImaging
> vtkIO
> vtkFiltering
> vtkCommon
> vtkzlib
> 
> ITKNumerics
> VXLNumerics 
> ITKCommon
> ITKBasicFilters
> ITKAlgorithms
> ITKIO
> ITKMetaIO
> itkpng
> itkzlib
> vtk_qt
> 
> #libeditor	    
> #libqnp	  
> #libqt
> #libqui
> 
> 
> ${QT_QT_LIBRARY}
> )
> 
> 
> IF(WIN32)
> ADD_DEFINITIONS(-DQT_DLL) 
> ENDIF(WIN32)
> 
> SET(NewProject_SRCS
> 
> affichage16coupes.cpp  		 
> affichage1coupe.cpp    	 newprojectwindow.cpp
> affichage4coupes.cpp   	 traitementITK.cpp
> affichage4vues.cpp     main.cpp			 vtkInteractorStyleCustom.cpp
> affichageVTK3D.cpp     
> affichageVTK.cpp       
> 
> )
> 
> SET(NewProject_MOC_SRCS 
> 
> affichage16coupes.h  affichageVTK3D.h  
> affichage1coupe.h    affichageVTK.h    newprojectwindow.h
> affichage4coupes.h   	       traitementITK.h
> affichage4vues.h        vtkInteractorStyleCustom.h
> 
> 
> )
> 
> IF(QT_WRAP_CPP)
>   QT_WRAP_CPP(NewProject NewProject_SRCS NewProject_MOC_SRCS)
> ENDIF(QT_WRAP_CPP)
> 
> 
> ADD_EXECUTABLE(NewProject NewProject_SRCS)
> 
> -------------------------------------------
> 
> 
> 
> and
> cmake and make results : 
> -------------------------------------------
> 
> [imho@imhosmachine NewProject]$ cmake
> -- Check for working C compiler: gcc -- works
> -- Check for working CXX compiler: g++ -- works
> -- Configuring done
> -- Generating done
> [imho@imhosmachine NewProject]$ make
> Building executable NewProject...
> affichage16coupes.o: In function
> `affichage16coupes::chargerImages(readerVTK*, int)':
> affichage16coupes.o(.text+0x24d7): undefined reference to
> `readerVTK::getReader()'
> affichage16coupes.o(.text+0x24fa): undefined reference to
> `readerVTK::getReader()'
> affichage16coupes.o(.text+0x251d): undefined reference to
> `readerVTK::getReader()'
> affichage16coupes.o(.text+0x2540): undefined reference to
> `readerVTK::getReader()'
> affichage16coupes.o(.text+0x2563): undefined reference to
> `readerVTK::getReader()'
> affichage16coupes.o(.text+0x2586): more undefined references to
> `readerVTK::getReader()' follow
> newprojectwindow.o: In function
> `NewProjectWindow::NewProjectWindow[not-in-charge](QWidget*, char
> const*, unsigned)':
> newprojectwindow.o(.text+0x1e6): undefined reference to
> `readerVTK::readerVTK[in-charge]()'
> newprojectwindow.o: In function
> `NewProjectWindow::NewProjectWindow[in-charge](QWidget*, char const*,
> unsigned)':
> newprojectwindow.o(.text+0x2944): undefined reference to
> `readerVTK::readerVTK[in-charge]()'
> newprojectwindow.o: In function `NewProjectWindow::Ouvrir()':
> newprojectwindow.o(.text+0x5244): undefined reference to
> `readerVTK::~readerVTK [in-charge]()'
> newprojectwindow.o(.text+0x5280): undefined reference to
> `readerVTK::readerVTK[in-charge]()'
> newprojectwindow.o(.text+0x5328): undefined reference to
> `readerVTK::chargerImage(QString*, int)'
> newprojectwindow.o(.text+0x53f4): undefined reference to
> `readerVTK::UpdateReader()'
> newprojectwindow.o: In function `NewProjectWindow::ChangeSerie()':
> newprojectwindow.o(.text+0x5941): undefined reference to
> `readerVTK::~readerVTK [in-charge]()'
> newprojectwindow.o(.text+0x597d): undefined reference to
> `readerVTK::readerVTK[in-charge]()'
> newprojectwindow.o(.text+0x5a2e): undefined reference to
> `readerVTK::chargerImage(QString*, int)'
> newprojectwindow.o(.text+0x5b03): undefined reference to
> `readerVTK::UpdateReader()'
> newprojectwindow.o: In function `NewProjectWindow::Aff1Coupe()':
> newprojectwindow.o(.text+0x5e2b): undefined reference to
> `vtkQtObjectFactory::SetQtBase(QWidget*, char*)'
> newprojectwindow.o(.text+0x5ea9): undefined reference to
> `vtkQtObjectFactory::QtWidget(vtkObject*)'
> newprojectwindow.o: In function `NewProjectWindow::Aff4Coupes()':
> newprojectwindow.o(.text+0x6339): undefined reference to
> `vtkQtObjectFactory::SetQtBase(QWidget*, char*)'
> newprojectwindow.o(.text+0x63b7): undefined reference to
> `vtkQtObjectFactory::QtWidget(vtkObject*)'
> newprojectwindow.o: In function `NewProjectWindow::Aff16Coupes()':
> newprojectwindow.o(.text+0x6849): undefined reference to
> `vtkQtObjectFactory::SetQtBase(QWidget*, char*)'
> newprojectwindow.o(.text+0x68c7): undefined reference to
> `vtkQtObjectFactory::QtWidget(vtkObject*)'
> newprojectwindow.o: In function `NewProjectWindow::Aff4Vues()':
> newprojectwindow.o(.text+0x6cc9): undefined reference to
> `vtkQtObjectFactory::SetQtBase(QWidget*, char*)'
> newprojectwindow.o(.text+0x6d47): undefined reference to
> `vtkQtObjectFactory::QtWidget(vtkObject*)'
> affichage4coupes.o: In function
> `affichage4coupes::chargerImages(readerVTK*, int)':
> affichage4coupes.o(.text+0xb0f): undefined reference to
> `readerVTK::getReader()'
> affichage4coupes.o(.text+0xb32): undefined reference to
> `readerVTK::getReader()'
> affichage4coupes.o(.text+0xb55): undefined reference to
> `readerVTK::getReader()'
> affichage4coupes.o(.text+0xb78): undefined reference to
> `readerVTK::getReader()'
> affichage4vues.o: In function `affichage4vues::chargerImages(readerVTK*,
> int)':
> affichage4vues.o(.text+0xacb): undefined reference to
> `readerVTK::getReader()'
> affichage4vues.o(.text+0xaee): more undefined references to
> `readerVTK::getReader()' follow
> main.o: In function `main':
> main.o(.text+0x15): undefined reference to
> `vtkQtObjectFactory::RegisterObjectFactory()'
> main.o(.text+0x30): undefined reference to `QGLFormat::hasOpenGL()'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `QGLWidget::updateGL()'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `QGLWidget::qt_emit(int, QUObject*)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `QGLWidget::initializeOverlayGL()'/usr/local/qt/lib/libvtk_qt.so:
> undefined reference to `QGLWidget::setFormat(QGLFormat const&)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to `non-virtual
> thunk [nv:-40] to
> vtkQGLRenderWindowInteractor::PrintSelf(std::basic_ostream<char,
> std::char_traits<char> >&, vtkIndent)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to `non-virtual
> thunk [nv:-40] to vtkQGLRenderWindowInteractor::Enable()'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `QGLWidget::resizeGL(int, int)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `QGLWidget::paintEvent(QPaintEvent*)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to `non-virtual
> thunk [nv:-40] to vtkQGLRenderWindowInteractor::Initialize()'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to `non-virtual
> thunk [nv:-40] to
> vtkQGLRenderWindowInteractor::~vtkQGLRenderWindowInteractor [in-charge
> deleting]()'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to `non-virtual
> thunk [nv:-40] to vtkQGLRenderWindowInteractor::DestroyTimer()'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `QGLWidget::initializeGL()'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to `non-virtual
> thunk [nv:-40] to vtkQGLRenderWindowInteractor::CreateTimer(int)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `QGLWidget::glInit()'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `vtkQGLRenderWindowInteractor::MouseMove(QMouseEvent const*)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `vtkQGLWindowQT::sizeHint() const'/usr/local/qt/lib/libvtk_qt.so:
> undefined reference to `vtkQGLWindowQT::keyPressEvent(QKeyEvent*)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `QGLWidget::setMouseTracking(bool)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `vtkQGLRenderWindowInteractor::CreateTimer(int)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `vtkQGLRenderWindowInteractor::TimerFunc()'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `QGLWidget::resizeOverlayGL(int, int)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `vtkQGLRenderWindowInteractor::KeyReleased(QKeyEvent*)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `QGLWidget::grabFrameBuffer(bool)'/usr/local/qt/lib/libvtk_qt.so:
> undefined reference to `non-virtual thunk [nv:-40] to
> vtkQGLRenderWindowInteractor::~vtkQGLRenderWindowInteractor
> [in-charge]()'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `QGLWidget::qt_cast(char const*)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `vtkQGLRenderWindowInteractor::Enable()'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `vtkQGLRenderWindowInteractor::Initialize()'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to `non-virtual
> thunk [nv:-40] to vtkQGLRenderWindowInteractor::UpdateSize(int, int)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `QGLWidget::renderPixmap(int, int, bool)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `vtkQGLRenderWindowInteractor::Start()'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `QGLWidget::updateOverlayGL()'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `vtkQGLWindowQT::mouseMoveEvent(QMouseEvent*)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `vtkQGLWindowQT::keyReleaseEvent(QKeyEvent*)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `QGLWidget::resizeEvent(QResizeEvent*)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `vtkQGLRenderWindowInteractor::RightButtonReleased(QMouseEvent const*)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `vtkQGLRenderWindowInteractor::RightButtonPressed(QMouseEvent const*)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `QGLWidget::makeCurrent()'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `vtkQGLRenderWindowInteractor::ButtonReleased(QMouseEvent const*)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `vtkQGLRenderWindowInteractor::LeftButtonReleased(QMouseEvent const*)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `QGLWidget::qt_property(int, int, QVariant*)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `QGLWidget::makeOverlayCurrent()'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `QGLWidget::setContext(QGLContext*, QGLContext const*, bool)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `vtkQGLRenderWindowInteractor::~vtkQGLRenderWindowInteractor
> [in-charge]()'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `vtkQGLWindowQT::setSizeHint(QSize)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `vtkQGLRenderWindowInteractor::Disable()'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `QGLWidget::swapBuffers()'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `QGLWidget::~QGLWidget [not-in-charge]()'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `vtkQGLWindowQT::mousePressEvent(QMouseEvent*)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to `typeinfo for
> QGLWidget'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `QGLWidget::paintGL()'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `vtkQGLRenderWindowInteractor::LeftButtonPressed(QMouseEvent const*)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `vtkQGLWindowQT::mouseReleaseEvent(QMouseEvent*)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `vtkQGLRenderWindowInteractor::MiddleButtonReleased(QMouseEvent const*)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `QGLWidget::reparent(QWidget*, unsigned, QPoint const&, bool)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `QGLWidget::qt_invoke(int, QUObject*)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to `non-virtual
> thunk [nv:-40] to vtkQGLRenderWindowInteractor::Start()'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `vtkQGLRenderWindowInteractor::~vtkQGLRenderWindowInteractor [in-charge
> deleting]()'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to `non-virtual
> thunk [nv:-40] to vtkQGLRenderWindowInteractor::Disable()'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `vtkQGLRenderWindowInteractor::PrintSelf(std::basic_ostream<char,
> std::char_traits<char> >&, vtkIndent)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `vtkQGLRenderWindowInteractor::KeyPressed(QKeyEvent*)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `vtkQGLRenderWindowInteractor::DestroyTimer()'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `QGLWidget::paintOverlayGL()'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `QGLWidget::glDraw()'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `QGLWidget::staticMetaObject()'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `vtkQGLRenderWindowInteractor::MiddleButtonPressed(QMouseEvent const*)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `vtkQGLRenderWindowInteractor::ButtonPressed(QMouseEvent const*)'
> /usr/local/qt/lib/libvtk_qt.so: undefined reference to
> `vtkQGLRenderWindowInteractor::UpdateSize(int, int)'
> collect2: ld returned 1 exit status
> make[1]: *** [NewProject] Erreur 1
> make: *** [default_target] Erreur 2
> 
> 
> --------------------------------------------
> 
> 
>