[Insight-users] Solved: Error using itk with qmake instead of cmake

Jürgen Konetschnig kone4040 at gmail.com
Sat Mar 21 16:06:40 EDT 2009


Hi,

After writing a minimal example I found the error. 
I had a previous version of ITK installed from the Ubuntu repositories
and so: 
-L/usr/lib 
caused the error. After removing the old ITK package from Ubuntu
everything worked just fine.

Stupid mistake. I did not remember I installed ITK from the repositories
2 or 3 month ago.

Thanks alot,

Juergen

> Hi
> 
> 
>  From the error message:
> 
> 
> "undefined reference to
> 
> `itk::ExceptionObject::ExceptionObject(std::basic_string<char, 
> std::char_traits<char>, std::allocator<char> > const&, unsigned int, 
> std::basic_string<char, std::char_traits<char>, std::allocator<char> > 
> const&, std::basic_string<char, std::char_traits<char>, 
> std::allocator<char> > const&)'
> collect2: ld gab 1 als Ende-Status zurück
> 
> ----
> 
> It would look like you were missing to link to the ITKCommon library,
> that is where the itkExceptionObject class is contained.  However,
> looking at the link line that you posted, the ITKCommon library
> actually appears there, and it is in the correct location with
> respect to the other ITK libraries.
> 
> 
> What may be happening is that your object:   SiftFeatures.o
> 
> Is somehow instantiated in one of the libraries that appear *after*
> ITKCommon in the link line... although... again... from your link
> line I don't see how this may be happening.
> 
> 
> Are you building ITK as a shared library ?
> 
> Is there any chance that you may have multiple ITK installations,
> and that they may be getting mixed at link time ?
> 
> 
> My suggestion would be to put together a minimal example,
> in which you build an ITK "Hello World", and configure it and
> building with qmake.
> 
> 
> 
>     Please let us know what you find...
> 
> 
> 
>         Thanks
> 
> 
>            Luis
> 
> 
> ---------------------------
> Jürgen Konetschnig wrote:
> > Hi,
> > 
> > I am new to ITK and I am using it with Qt's qmake instead of cmake. When
> > I try to call:
> > 	const int dimension = 2;
> > 	typedef itk::Image< float, dimension > ImageType;
> > 	ImageType::Pointer newp = ImageType::New();
> > 
> > in a method i get the following error:
> > make -j all 
> > g++ -c -pipe -g -D_REENTRANT -Wall -W -DUSELOGIC -DKSUSEFASTLISTLOOKUP
> > -DQT_XML_LIB -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
> > -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore
> > -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui
> > -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL
> > -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4/QtXml
> > -I/usr/include/qt4/QtXml -I/usr/include/qt4 -I. -I..
> > -IReconstruction/KSReco -I/usr/local/include/InsightToolkit
> > -I/usr/local/include/InsightToolkit/Algorithms
> > -I/usr/local/include/InsightToolkit/BasicFilters
> > -I/usr/local/include/InsightToolkit/Common
> > -I/usr/local/include/InsightToolkit/IO
> > -I/usr/local/include/InsightToolkit/Numerics
> > -I/usr/local/include/InsightToolkit/SpatialObject
> > -I/usr/local/include/InsightToolkit/Utilities
> > -I/usr/local/include/InsightToolkit/Utilities/vxl/core
> > -I/usr/local/include/InsightToolkit/Utilities/vxl/vcl
> > -I/usr/X11R6/include -I/usr/local/Coin-3.0.0/include
> > -I/usr/X11R6/include -Ibuild_moc -Ibuild_ui -o build_d/SiftFeatures.o
> > Utilities/Sift/SiftFeatures.cxx
> > g++ -Wl,--no-undefined -o OpenCARd build_d/CARNameEditor.o
> > build_d/CARCacheDialog.o build_d/CARReconDialog.o build_d/CARTracer.o
> > build_d/CARAboutDialog.o build_d/RegistrationHelper.o build_d/CARView.o
> > build_d/CARListView.o build_d/CARProjectPref.o build_d/CARList.o
> > build_d/CDMDialog.o build_d/ProjectView.o build_d/SliceView.o
> > build_d/ImageView.o build_d/ObjectView.o build_d/CARDataViewer.o
> > build_d/CARDataViewerUpdate.o build_d/CARDataViz.o
> > build_d/CARDataVizImages.o build_d/CARIVImages.o
> > build_d/CARCoord3Manip.o build_d/CARTransformerDragger.o
> > build_d/CARTransformerManip.o build_d/CARValue.o
> > build_d/CARChangeValue.o build_d/CARRotationValue.o
> > build_d/CARSqzDialog.o build_d/CARSqueeze.o build_d/CARSqueezeMonitor.o
> > build_d/CARDataEditor.o build_d/CARDataEditorContour.o
> > build_d/CARDataEditorPick.o build_d/CARVRMLViewer.o
> > build_d/CARVRMLMainWindow.o build_d/CARVRMLAnimation.o
> > build_d/CARVRMLPovray.o build_d/CARVRMLMCell.o
> > build_d/CARVRMLColorEditor.o build_d/CARVRMLValueEditor.o
> > build_d/CARVRMLShapeState.o build_d/CARVRMLMaterialEditor.o
> > build_d/ProjectWizard.o build_d/CARItemModel.o
> > build_d/WizardListWidget.o build_d/CARSelection.o
> > build_d/CARDataManager.o build_d/CARData.o build_d/CARSqz.o
> > build_d/CARDataContour.o build_d/CARDataObject.o
> > build_d/CARDataProject.o build_d/CARDataSlice.o build_d/CARDataImage.o
> > build_d/CARDataCreate.o build_d/CARDataDelete.o build_d/CARDataFind.o
> > build_d/CARDataIO.o build_d/CARDataTrace.o build_d/CARDataVersion.o
> > build_d/CDMBase.o build_d/CDMProject.o build_d/CDMSlice.o
> > build_d/CDMObject.o build_d/CDMImage.o build_d/CDMTrace.o
> > build_d/kstable.o build_d/ksv2bld.o build_d/ksv3bld.o build_d/lu.o
> > build_d/vorlist.o build_d/slicedel.o build_d/prepross.o build_d/del3d.o
> > build_d/Rec3D.o build_d/IV3DSimpleRec.o build_d/IV3DRec.o
> > build_d/helpBrowser.o build_d/IndexManager.o build_d/UnitsManager.o
> > build_d/md5.o build_d/qcheckdata.o build_d/qcheckfile.o
> > build_d/qchecklist.o build_d/qcurse.o build_d/qread.o build_d/qversion.o
> > build_d/QueueProcessor.o build_d/ImageReader.o build_d/Egyptian.o
> > build_d/PyramidWriter.o build_d/CacheViewer.o build_d/Preview.o
> > build_d/PreviewView.o build_d/LandmarkRegistration.o
> > build_d/SiftFeatures.o build_d/SiftXmlHandler.o build_d/OpenCAR.o
> > build_d/main.o build_d/moc_CARNameEditor.o build_d/moc_CARCacheDialog.o
> > build_d/moc_CARReconDialog.o build_d/moc_CARAboutDialog.o
> > build_d/moc_RegistrationHelper.o build_d/moc_CARView.o
> > build_d/moc_CARListView.o build_d/moc_CARProjectPref.o
> > build_d/moc_CARList.o build_d/moc_BaseView.o build_d/moc_CDMDialog.o
> > build_d/moc_ProjectView.o build_d/moc_SliceView.o
> > build_d/moc_ImageView.o build_d/moc_ObjectView.o
> > build_d/moc_CARDataViewer.o build_d/moc_CARIVImages.o
> > build_d/moc_CARChangeValue.o build_d/moc_CARRotationValue.o
> > build_d/moc_CARSqzDialog.o build_d/moc_CARSqueeze.o
> > build_d/moc_CARDataEditor.o build_d/moc_CARVRMLViewer.o
> > build_d/moc_CARVRMLMainWindow.o build_d/moc_CARVRMLAnimation.o
> > build_d/moc_CARVRMLColorEditor.o build_d/moc_CARVRMLValueEditor.o
> > build_d/moc_CARVRMLMaterialEditor.o build_d/moc_ProjectWizard.o
> > build_d/moc_CARItemModel.o build_d/moc_WizardListWidget.o
> > build_d/moc_CARDataManager.o build_d/moc_CDMBase.o
> > build_d/moc_CDMProject.o build_d/moc_CDMSlice.o build_d/moc_CDMObject.o
> > build_d/moc_CDMImage.o build_d/moc_CDMTrace.o
> > build_d/moc_QueueProcessor.o build_d/moc_ImageReader.o
> > build_d/moc_Egyptian.o build_d/moc_PyramidWriter.o
> > build_d/moc_CacheViewer.o build_d/moc_Preview.o
> > build_d/moc_PreviewView.o build_d/moc_helpBrowser.o
> > build_d/moc_OpenCAR.o build_d/qrc_OpenCAR.o    -L/usr/lib
> > -L/usr/X11R6/lib -L/usr/local/lib/InsightToolkit -lITKAlgorithms
> > -lITKEXPAT -lITKIO -lITKMetaIO -lITKniftiio -lITKNumerics
> > -lITKStatistics -lITKFEM -lITKDICOMParser -lITKNrrdIO -lITKSpatialObject
> > -lITKBasicFilters -lITKCommon -litkjpeg16 -litkpng -litktiff
> > -litkvnl_algo -litkv3p_netlib -litkvnl_inst -litkgdcm -litkjpeg8
> > -litkvcl -litkjpeg12 -litkopenjpeg -litksys -litkvnl -lITKznz
> > -L/usr/local/Coin-3.0.0/lib -lCoin -lSoQt -lQtXml -lQtOpenGL -lQtGui
> > -lQtCore -lGLU -lGL -lpthread
> > build_d/SiftFeatures.o: In function
> > `itk::MemoryAllocationError::MemoryAllocationError(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
> > SiftFeatures.cxx:(.text._ZN3itk21MemoryAllocationErrorC1ERKSsjS2_S2_[itk::MemoryAllocationError::MemoryAllocationError(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)]+0x29): undefined reference to `itk::ExceptionObject::ExceptionObject(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
> > collect2: ld gab 1 als Ende-Status zurück
> > make: *** [OpenCARd] Fehler 1
> > 
> > I included "itkImage.h". Maybe someone has a clue what I am doing wrong.
> > 
> > Thanks,
> > Jürgen
> > 
> > _____________________________________
> > Powered by www.kitware.com
> > 
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> > 
> > Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ
> > 
> > Follow this link to subscribe/unsubscribe:
> > http://www.itk.org/mailman/listinfo/insight-users
> > 



More information about the Insight-users mailing list