[solved]ITK-VTK-Qt:Linking problem
-
Hi friends,
I have a problem in linking the Qt with ITK and VTK libraries. Some information about my problem:
- The ITK and VTK libraries are ".a" ending file i think these are static library files. I tried to link these files into my Qt Project but i couldn't do it successfully. I always get the following problem
@
:-1: error: symbol(s) not found for architecture x86_64
:-1: error: linker command failed with exit code 1 (use -v to see invocation)
@But when i try to build it with CMake, it gets build without any problem. So i guess the problem is with linking the libraries with the QtCreator. I would like to whats the mistake i am making.
@#-------------------------------------------------
Project created by QtCreator 2013-08-01T12:11:35
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Mainwindow
TEMPLATE = app
INCLUDEPATH+= /usr/local/include/ITK-4.4
/usr/local/include/vtk-5.10
DEPENDPATH+=/usr/local/include/ITK-4.4
/usr/local/include/vtk-5.10
LIBS += -L/usr/local/lib/
-lITKBiasCorrection-4.4
-lITKBioCell-4.4
-lITKCommon-4.4
-lITKDICOMParser-4.4
-litkdouble-conversion-4.4
-lITKEXPAT-4.4
-ITKFEM-4.4
-litkgdcmCommon-4.4
-litkgdcmDICT-4.4
-litkgdcmDSED-4.4
-litkgdcmIOD-4.4
-litkgdcmjpeg8-4.4
-litkgdcmjpeg12-4.4
-litkgdcmjpeg16-4.4
-litkgdcmMSFF-4.4
-litkgdcmuuid-4.4
-lITKgiftiio-4.4
-litkhdf5_cpp-4.4
-litkhdf5-4.4
-lITKIOBioRad-4.4
-lITKIOBMP-4.4
-lITKIOCSV-4.4
-lITKIOGDCM-4.4
-lITKIOGE-4.4
-lITKIOGIPL-4.4
-lITKIOHDF5-4.4
-lITKIOImageBase-4.4
-lITKIOIPL-4.4
-lITKIOJPEG-4.4
-lITKIOLSM-4.4
-lITKIOMesh-4.4
-lITKIOMeta-4.4
-lITKIONIFTI-4.4
-lITKIONRRD-4.4
-lITKIOPNG-4.4
-lITKIOSiemens-4.4
-lITKIOSpatialObjects-4.4
-lITKIOStimulate-4.4
-lITKIOTIFF-4.4
-lITKIOTransformBase-4.4
-lITKIOTransformHDF5-4.4
-lITKIOTransformInsightLegacy-4.4
-lITKIOTransformMatlab-4.4
-lITKIOVTK-4.4
-lITKIOXML-4.4
-litkjpeg-4.4
-lITKKLMRegionGrowing-4.4
-lITKLabelMap-4.4
-lITKMesh-4.4
-lITKMetaIO-4.4
-litkNetlibSlatec-4.4
-lITKniftiio-4.4
-lITKNrrdIO-4.4
-litkopenjpeg-4.4
-lITKOptimizers-4.4
-lITKOptimizersv4-4.4
-lITKPath-4.4
-litkpng-4.4
-lITKPolynomials-4.4
-lITKQuadEdgeMesh-4.4
-lITKReview-4.4
-lITKSpatialObjects-4.4
-lITKStatistics-4.4
-litksys-4.4
-litktiff-4.4
-litkv3p_lsqr-4.4
-litkv3p_netlib-4.4
-litkvcl-4.4
-lITKVideoCore-4.4
-lITKVideoIO-4.4
-litkvnl_algo-4.4
-litkvnl-4.4
-lITKVNLInstantiation-4.4
-lITKVTK-4.4
-lITKWatersheds-4.4
-litkzlib-4.4
-lITKznz-4.4LIBS += -L/usr/local/lib/vtk-5.10/
-lLSDyna
-lMapReduceMPI
-lmpistubs
-lQVTK
-lvtkalglib
-lvtkCharts
-lvtkCommon
-lvtkDICOMParser
-lvtkexoIIc
-lvtkexpat
-lvtkFiltering
-lvtkfreetype
-lvtkftgl
-lvtkGenericFiltering
-lvtkGeovis
-lvtkGraphics
-lvtkhdf5_hl
-lvtkhdf5
-lvtkHybrid
-lvtkImaging
-lvtkInfovis
-lvtkIO
-lvtkjpeg
-lvtklibxml2
-lvtkmetaio
-lvtkNetCDF_cxx
-lvtkNetCDF
-lvtkpng
-lvtkproj4
-lvtkRendering
-lvtksqlite
-lvtksys
-lvtktiff
-lvtkverdict
-lvtkViews
-lvtkVolumeRendering
-lvtkWidgets
-lvtkzlibSOURCES +=main.cpp
widget.cpp
AbsoluteValueDifferenceImageFilter.cpp
listWidget.cppHEADERS += widget.h
listWidget.h
absolutevaluedifferenceimagefilter.h
itkImageToVtkImageFilter.h
FORMS += widget.uiRESOURCES +=
datas.qrc
#set MAC CoreFoundation includes
LIBS += -framework CoreFoundation
@ -
Hi,
The problem i am getting is
@
Undefined symbols for architecture x86_64:
"_CGDisplayIOServicePort", referenced from:
vtkCoreGraphicsGPUInfoList::Probe() in libvtkRendering.a(vtkCoreGraphicsGPUInfoList.cxx.o)
"_CGGetActiveDisplayList", referenced from:
vtkCoreGraphicsGPUInfoList::Probe() in libvtkRendering.a(vtkCoreGraphicsGPUInfoList.cxx.o)
"_CGWarpMouseCursorPosition", referenced from:
vtkCocoaRenderWindow::SetCursorPosition(int, int) in libvtkRendering.a(vtkCocoaRenderWindow.mm.o)
"_CGWindowLevelForKey", referenced from:
vtkCocoaRenderWindow::CreateAWindow() in libvtkRendering.a(vtkCocoaRenderWindow.mm.o)
"_IORegistryEntrySearchCFProperty", referenced from:
vtkCoreGraphicsGPUInfoList::Probe() in libvtkRendering.a(vtkCoreGraphicsGPUInfoList.cxx.o)
"_NSEventTrackingRunLoopMode", referenced from:
-[vtkCocoaTimer startTimerWithInterval:repeating:] in libvtkRendering.a(vtkCocoaRenderWindowInteractor.mm.o)
-[vtkCocoaGLView mouseDown:] in libvtkRendering.a(vtkCocoaGLView.mm.o)
-[vtkCocoaGLView rightMouseDown:] in libvtkRendering.a(vtkCocoaGLView.mm.o)
-[vtkCocoaGLView otherMouseDown:] in libvtkRendering.a(vtkCocoaGLView.mm.o)
"_NSPointInRect", referenced from:
-[vtkCocoaGLView mouseMoved:] in libvtkRendering.a(vtkCocoaGLView.mm.o)
"_NSWindowWillCloseNotification", referenced from:
-[vtkCocoaServer start] in libvtkRendering.a(vtkCocoaRenderWindowInteractor.mm.o)
-[vtkCocoaServer windowWillClose:] in libvtkRendering.a(vtkCocoaRenderWindowInteractor.mm.o)
"OBJC_CLASS$_NSApplication", referenced from:
objc-class-ref in libvtkRendering.a(vtkCocoaRenderWindow.mm.o)
objc-class-ref in libvtkRendering.a(vtkCocoaRenderWindowInteractor.mm.o)
objc-class-ref in libvtkRendering.a(vtkCocoaGLView.mm.o)
"OBJC_CLASS$_NSAutoreleasePool", referenced from:
objc-class-ref in libvtkRendering.a(vtkCocoaRenderWindowInteractor.mm.o)
"OBJC_CLASS$_NSCursor", referenced from:
objc-class-ref in libvtkRendering.a(vtkCocoaRenderWindow.mm.o)
"OBJC_CLASS$_NSEvent", referenced from:
objc-class-ref in libvtkRendering.a(vtkCocoaRenderWindowInteractor.mm.o)
"OBJC_CLASS$_NSNotificationCenter", referenced from:
objc-class-ref in libvtkRendering.a(vtkCocoaRenderWindowInteractor.mm.o)
libvtkRendering.a(vtkOpenGLRenderer.cxx.o)
vtkOpenGLRenderer::Clear() in libvtkRendering.a(vtkOpenGLRenderer.cxx.o)
vtkCocoaRenderWindow::DestroyWindow() in libvtkRendering.a(vtkCocoaRenderWindow.mm.o)
...
"_glDisableClientState", referenced from:
vtkOpenGLPainterDeviceAdapter::DisableAttributeArray(int) in libvtkRendering.a(vtkOpenGLPainterDeviceAdapter.cxx.o)
"_glDrawArrays", referenced from:
vtkOpenGLPainterDeviceAdapter::DrawArrays(int, long long, long long) in libvtkRendering.a(vtkOpenGLPainterDeviceAdapter.cxx.o)
"_glDrawBuffer", referenced from:
vtkOpenGLCamera::Render(vtkRenderer*) in libvtkRendering.a(vtkOpenGLCamera.cxx.o)
vtkOpenGLRenderWindow::SetPixelData(int, int, int, int, unsigned char*, int) in libvtkRendering.a(vtkOpenGLRenderWindow.cxx.o)
vtkOpenGLRenderWindow::SetRGBAPixelData(int, int, int, int, float*, int, int) in libvtkRendering.a(vtkOpenGLRenderWindow.cxx.o)@
I know i am missing some important Libraries, but i have added all the libs which comes from itk and vtk. I think the problem is with the @libvtkRendering.a@ declaration in QT project file.
-
Hi,
It seems you are not linking to all needed frameworks like Cocoa
-
You can run otool -L on the library.
In this case, it seems you are missing frameworks not just libraries (e.g. -framework Cocoa)