[Insight-users] link error when learning (Getting Started with ITK + VTK)
Luis Ibanez
luis.ibanez at kitware.com
Sat Oct 31 13:20:36 EDT 2009
Hi Phil,
Thanks for letting us know that you found the solution to the problem.
Regards,
Luis
------------------------------------------------------
On Wed, Oct 28, 2009 at 4:26 PM, Radtke, Phil <pradtke at vt.edu> wrote:
> reinstalled vtk and problem solved. Thanks.
> ________________________________________
> From: Luis Ibanez [luis.ibanez at kitware.com]
> Sent: Tuesday, October 27, 2009 7:35 AM
> To: Radtke, Phil
> Cc: insight-users at itk.org
> Subject: Re: [Insight-users] link error when learning (Getting Started with ITK + VTK)
>
> Hi Phil,
>
> Thanks for the clear description of the problem
> and for posting the source code.
>
> I tried this in my GNU/Linux installation, and the
> program compile and links fine for me. :-/
>
> Note that in Linux the order of the libraries in the
> link line is important. (however, the fact that this
> links fine in my Linux installation discards the
> library order as a problem...).
>
> Is there any chance that you may have multiple
> versions of VTK installed in your computer and
> that they may be having a conflict with each other ?
>
> Try doing:
>
> make VERBOSE=1
>
>
> This may help you verify what libraries are being
> linked.
>
>
> In my case, the output of "make VERBOSE=1" is:
>
> /home/ibanez/bin/CMake/bin/cmake
> -H/home/ibanez/src/UsersITK/PhilRadtke/Source
> -B/home/ibanez/src/UsersITK/PhilRadtke/Binary --check-build-system
> CMakeFiles/Makefile.cmake 0
> /home/ibanez/bin/CMake/bin/cmake -E cmake_progress_start
> /home/ibanez/src/UsersITK/PhilRadtke/Binary/CMakeFiles
> /home/ibanez/src/UsersITK/PhilRadtke/Binary/CMakeFiles/progress.make
> make -f CMakeFiles/Makefile2 all
> make[1]: Entering directory `/home/ibanez/src/UsersITK/PhilRadtke/Binary'
> make -f CMakeFiles/myProject.dir/build.make CMakeFiles/myProject.dir/depend
> make[2]: Entering directory `/home/ibanez/src/UsersITK/PhilRadtke/Binary'
> cd /home/ibanez/src/UsersITK/PhilRadtke/Binary &&
> /home/ibanez/bin/CMake/bin/cmake -E cmake_depends "Unix Makefiles"
> /home/ibanez/src/UsersITK/PhilRadtke/Source
> /home/ibanez/src/UsersITK/PhilRadtke/Source
> /home/ibanez/src/UsersITK/PhilRadtke/Binary
> /home/ibanez/src/UsersITK/PhilRadtke/Binary
> /home/ibanez/src/UsersITK/PhilRadtke/Binary/CMakeFiles/myProject.dir/DependInfo.cmake
> --color=
> make[2]: Leaving directory `/home/ibanez/src/UsersITK/PhilRadtke/Binary'
> make -f CMakeFiles/myProject.dir/build.make CMakeFiles/myProject.dir/build
> make[2]: Entering directory `/home/ibanez/src/UsersITK/PhilRadtke/Binary'
> /home/ibanez/bin/CMake/bin/cmake -E cmake_progress_report
> /home/ibanez/src/UsersITK/PhilRadtke/Binary/CMakeFiles 1
> [100%] Building CXX object CMakeFiles/myProject.dir/myProject.cxx.o
> /usr/bin/g++-4.2 -ftemplate-depth-50 -Wall -Wno-deprecated
> -Wno-deprecated -I/home/ibanez/src/Insight/Code/Review
> -I/home/ibanez/src/Insight/Code/Patented
> -I/home/ibanez/src/Insight/Utilities/gdcm/src
> -I/home/ibanez/bin/Insight/Utilities/gdcm
> -I/home/ibanez/bin/Insight/Utilities/vxl/core
> -I/home/ibanez/bin/Insight/Utilities/vxl/vcl
> -I/home/ibanez/bin/Insight/Utilities/vxl/v3p/netlib
> -I/home/ibanez/src/Insight/Utilities/vxl/core
> -I/home/ibanez/src/Insight/Utilities/vxl/vcl
> -I/home/ibanez/src/Insight/Utilities/vxl/v3p/netlib
> -I/home/ibanez/src/Insight/Code/Numerics/Statistics
> -I/home/ibanez/src/Insight/Utilities
> -I/home/ibanez/bin/Insight/Utilities
> -I/home/ibanez/src/Insight/Utilities/itkExtHdrs
> -I/home/ibanez/src/Insight/Utilities/nifti/znzlib
> -I/home/ibanez/src/Insight/Utilities/nifti/niftilib
> -I/home/ibanez/src/Insight/Utilities/expat
> -I/home/ibanez/bin/Insight/Utilities/expat
> -I/home/ibanez/bin/Insight/Utilities/DICOMParser
> -I/home/ibanez/src/Insight/Utilities/DICOMParser
> -I/home/ibanez/bin/Insight/Utilities/NrrdIO
> -I/home/ibanez/src/Insight/Utilities/NrrdIO
> -I/home/ibanez/src/Insight/Utilities/MetaIO
> -I/home/ibanez/src/Insight/Code/SpatialObject
> -I/home/ibanez/src/Insight/Code/Numerics/NeuralNetworks
> -I/home/ibanez/src/Insight/Code/Numerics/FEM
> -I/home/ibanez/src/Insight/Code/IO
> -I/home/ibanez/src/Insight/Code/Numerics
> -I/home/ibanez/src/Insight/Code/Common
> -I/home/ibanez/src/Insight/Code/BasicFilters
> -I/home/ibanez/src/Insight/Code/Algorithms -I/home/ibanez/bin/Insight
> -I/home/ibanez/bin/VTK -I/home/ibanez/bin/VTK/Common
> -I/home/ibanez/bin/VTK/Utilities
> -I/home/ibanez/bin/VTK/VolumeRendering
> -I/home/ibanez/bin/VTK/Rendering
> -I/home/ibanez/bin/VTK/Utilities/vtkalglib
> -I/home/ibanez/src/VTK/Infovis -I/home/ibanez/src/VTK/Geovis
> -I/home/ibanez/src/VTK/Views -I/home/ibanez/src/VTK/Parallel
> -I/home/ibanez/src/VTK/VolumeRendering -I/home/ibanez/src/VTK/Hybrid
> -I/home/ibanez/src/VTK/Widgets -I/home/ibanez/src/VTK/Rendering
> -I/home/ibanez/src/VTK/Rendering/Testing/Cxx -I/home/ibanez/src/VTK/IO
> -I/home/ibanez/src/VTK/Imaging -I/home/ibanez/src/VTK/Graphics
> -I/home/ibanez/src/VTK/GenericFiltering
> -I/home/ibanez/src/VTK/Filtering -I/home/ibanez/src/VTK/Common
> -I/home/ibanez/src/VTK/Utilities
> -I/home/ibanez/src/VTK/Common/Testing/Cxx
> -I/home/ibanez/bin/VTK/Utilities/vtklibproj4
> -I/home/ibanez/src/VTK/Utilities/vtklibproj4
> -I/home/ibanez/bin/VTK/Utilities/DICOMParser
> -I/home/ibanez/src/VTK/Utilities/DICOMParser
> -I/home/ibanez/bin/VTK/Utilities/vtkfreetype/include
> -I/home/ibanez/src/VTK/Utilities/vtkfreetype/include
> -I/home/ibanez/bin/VTK/Utilities/vtknetcdf
> -I/home/ibanez/src/VTK/Utilities/vtknetcdf
> -I/home/ibanez/bin/VTK/Utilities/vtkexodus2/include
> -I/home/ibanez/src/VTK/Utilities/vtkexodus2/include
> -I/home/ibanez/bin/VTK/Utilities/MaterialLibrary
> -I/home/ibanez/src/VTK/Utilities/MaterialLibrary
> -I/home/ibanez/bin/VTK/Utilities/verdict
> -I/home/ibanez/src/VTK/Utilities/verdict
> -I/home/ibanez/src/VTK/Utilities/utf8/source
> -I/home/ibanez/src/VTK/Utilities/vtkalglib -I/usr/include/tcl8.4
> -I/home/ibanez/src/UsersITK/PhilRadtke/Source -o
> CMakeFiles/myProject.dir/myProject.cxx.o -c
> /home/ibanez/src/UsersITK/PhilRadtke/Source/myProject.cxx
> Linking CXX executable myProject
> /home/ibanez/bin/CMake/bin/cmake -E cmake_link_script
> CMakeFiles/myProject.dir/link.txt --verbose=1
> /usr/bin/g++-4.2 -ftemplate-depth-50 -Wall -Wno-deprecated
> -Wno-deprecated -fPIC CMakeFiles/myProject.dir/myProject.cxx.o -o
> myProject -rdynamic -L/home/ibanez/bin/Insight/bin
> -L/home/ibanez/bin/VTK/bin -lITKBasicFilters -lITKCommon -lITKIO
> -lvtkRendering -lvtkGraphics -lvtkHybrid -lvtkImaging -lvtkIO
> -lvtkFiltering -lvtkCommon -lITKNrrdIO -litkgdcm -litkjpeg12
> -litkjpeg16 -litkopenjpeg -luuid -litkpng -litktiff -litkjpeg8
> -lITKSpatialObject -lITKMetaIO -lITKDICOMParser -lITKEXPAT
> -lITKniftiio -lITKznz -litkzlib -lITKTransformIOReview -lITKCommon
> -litkvnl_inst -litkvnl_algo -litkv3p_netlib -litkvnl -litkvcl -lm
> -litksys -lvtkParallel -lvtkRendering -lvtkGraphics -lvtkverdict
> -lvtkImaging -lvtkftgl -lvtkfreetype -lXt -lSM -lICE -lX11 -lXext
> -lXft -lvtkIO -lmysqlclient -lz -lvtkFiltering -lvtkCommon
> -lvtkDICOMParser -lvtkmetaio -lvtksqlite -lpthread -lvtkpng -lvtktiff
> -lm -lvtkzlib -lvtkjpeg -lvtkexpat -lvtksys -ldl -lGL -lvtkexoIIc
> -lvtkNetCDF -Wl,-rpath,/home/ibanez/bin/Insight/bin:/home/ibanez/bin/VTK/bin
> make[2]: Leaving directory `/home/ibanez/src/UsersITK/PhilRadtke/Binary'
> /home/ibanez/bin/CMake/bin/cmake -E cmake_progress_report
> /home/ibanez/src/UsersITK/PhilRadtke/Binary/CMakeFiles 1
> [100%] Built target myProject
> make[1]: Leaving directory `/home/ibanez/src/UsersITK/PhilRadtke/Binary'
> /home/ibanez/bin/CMake/bin/cmake -E cmake_progress_start
> /home/ibanez/src/UsersITK/PhilRadtke/Binary/CMakeFiles 0
>
>
>
> Regards,
>
>
> Luis
>
>
>
> --------------------------------------------------------------------------
> On Tue, Oct 27, 2009 at 1:26 AM, Radtke, Phil <pradtke at vt.edu> wrote:
>> 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;
>> }
>> _____________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Kitware offers ITK Training Courses, for more information visit:
>> http://www.kitware.com/products/protraining.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