[Insight-users] link error when learning (Getting Started with ITK + VTK)
Radtke, Phil
pradtke at vt.edu
Tue Oct 27 01:26:39 EDT 2009
Hello,
Working through "Getting Started with ITK + VTK (part II)", it looks to me like the vtkRendering and vtkImaging libraries are not getting linked into my project. I listed vtkRendering and vtkImaging in a TARGET_LINK_LIBRARIES definition for cmake and the library files `libvtkRendering.a' and `libvtkImaging.a' are in my vtk_binary/bin/ directory. Thanks for any help or suggestions.
-Phil Radtke
Virginia Tech,
Forest Resources and Environmental Conservation
****** output from make ******
CMakeFiles/myProject.dir/myProject.cxx.o:myProject.cxx:(.text+0x1ec): undefined reference to `__imp___ZN14vtkImageViewer
3NewEv'
CMakeFiles/myProject.dir/myProject.cxx.o:myProject.cxx:(.text+0x1f6): undefined reference to `__imp___ZN25vtkRenderWindo
wInteractor3NewEv'
CMakeFiles/myProject.dir/myProject.cxx.o:myProject.cxx:(.text+0x20d): undefined reference to `__imp___ZN14vtkImageViewer
15SetupInteractorEP25vtkRenderWindowInteractor'
CMakeFiles/myProject.dir/myProject.cxx.o:myProject.cxx:(.text$_ZNK3itk21ImageToVTKImageFilterINS_5ImageItLj2EEEE9GetOutp
utEv[itk::ImageToVTKImageFilter<itk::Image<unsigned short, 2u> >::GetOutput() const]+0x10): undefined reference to `__im
p___ZN17vtkImageAlgorithm9GetOutputEv'
CMakeFiles/myProject.dir/myProject.cxx.o:myProject.cxx:(.text$_ZN3itk21ImageToVTKImageFilterINS_5ImageItLj2EEEEC1Ev[itk:
:ImageToVTKImageFilter<itk::Image<unsigned short, 2u> >::ImageToVTKImageFilter()]+0x6f): undefined reference to `__imp__
_ZN14vtkImageImport3NewEv'
collect2: ld returned 1 exit status
make[2]: *** [myProject.exe] Error 1
make[1]: *** [CMakeFiles/myProject.dir/all] Error 2
make: *** [all] Error 2
***** cMakeLists.txt contents: ******
PROJECT(myProject)
cmake_minimum_required(VERSION 2.6)
FIND_PACKAGE ( ITK)
IF ( ITK_FOUND)
INCLUDE( ${USE_ITK_FILE} )
ENDIF( ITK_FOUND)
FIND_PACKAGE ( VTK)
IF ( VTK_FOUND)
INCLUDE( ${USE_VTK_FILE} )
ENDIF( VTK_FOUND)
INCLUDE_DIRECTORIES(
${/home/pradtke/Source/myProject}
${/home/pradtke/Source/myProject/hidden}
)
ADD_EXECUTABLE( myProject myProject.cxx)
TARGET_LINK_LIBRARIES ( myProject
ITKBasicFilters ITKCommon ITKIO vtkRendering
vtkGraphics vtkHybrid vtkImaging vtkIO vtkFiltering vtkCommon)
***** myProject.cxx contents: *****
#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkImageToVTKImageFilter.h"
#include "vtkImageViewer.h"
#include "vtkRenderWindowInteractor.h"
int main( int argc, char **argv) {
typedef itk::Image<unsigned short,2> ImageType;
typedef itk::ImageFileReader<ImageType> ReaderType;
typedef itk::ImageToVTKImageFilter<ImageType> ConnectorType;
ReaderType::Pointer reader= ReaderType::New();
ConnectorType::Pointer connector= ConnectorType::New();
reader->SetFileName( argv[1]);
connector->SetInput( reader->GetOutput() );
vtkImageViewer * viewer = vtkImageViewer::New();
vtkRenderWindowInteractor * renderWindowInteractor =
vtkRenderWindowInteractor::New();
viewer->SetupInteractor( renderWindowInteractor);
viewer->SetInput( connector->GetOutput() );
viewer->Render();viewer->SetColorWindow( 255);
viewer->SetColorLevel( 128);
renderWindowInteractor->Start();
return 0;
}
More information about the Insight-users
mailing list