[Insight-users] A problem with compilation...

Luis Ibanez luis . ibanez at kitware . com
Mon, 03 Nov 2003 09:33:16 -0500


Hi BeeJay,

Thanks for sending the full description of your
problem, including the error messages.

Since you are moving the Image2.cxx example
to an independet folder and creating your own
CMakeLists.txt file, the only thing missing is
the ITKIO library in the TARGET_LINK_LIBRARIES()
command.

Your CMakeLists.txt file says:

 > TARGET_LINK_LIBRARIES(Image ITKCommon)

but it should be:

 > TARGET_LINK_LIBRARIES(Image ITKIO ITKCommon)

The ImageIO classes are defined in the ITKIO
library.

Please look first at the tutorial sessions in

     http://www . itk . org/HTML/Tutorials . htm

in particular to

http://www . itk . org/CourseWare/Training/GettingStarted-I . pdf



Regards,


    Luis




----------------------
Sentil Balaji wrote:
> Hey Luis,
>   The details of the errors are below:
>    I  am compiling the program to read  an imagefile
> .The .cxx file is in a separate outside folder  and I
> used the CMakelists.txt file that contains the
> information below:
> ------------------------------------------------------
> # This project is designed to be built outside the
> Insight source tree.
> PROJECT(ImageReader)
> 
> # Find ITK.
> FIND_PACKAGE(ITK)
> IF(ITK_FOUND)
>   INCLUDE(${ITK_USE_FILE})
> ELSE(ITK_FOUND)
>   MESSAGE(FATAL_ERROR
>           "Cannot build without ITK.  Please set
> ITK_DIR.")
> ENDIF(ITK_FOUND)
> 
> ADD_EXECUTABLE(Image rd.cxx )
> 
> TARGET_LINK_LIBRARIES(Image ITKCommon)
> -------------------------------------------------------
> ERROR MESSAGE
> -------------------------------------------------------
> Linking...
> rd.obj : error LNK2001: unresolved external symbol
> "public: static class itk::SmartPointer<class
> itk::ImageIOBase>  __cdecl
> itk::ImageIOFactory::CreateImageIO(char const *,enum
> itk::ImageIOFactory::FileModeType)"
> (?CreateImageIO at ImageIOFactory@itk@@
> SA?AV?$SmartPointer at VImageIOBase@itk@@@2 at PBDW4FileModeType@12@@Z)
> rd.obj : error LNK2001: unresolved external symbol
> "public: unsigned int __thiscall
> itk::ImageIOBase::GetImageSizeInBytes(void)const "
> (?GetImageSizeInBytes at ImageIOBase@itk@@QBEIXZ)
> Debug/Image.exe : fatal error LNK1120: 2 unresolved
> externals
> Error executing link.exe.
> 
> ALL_BUILD - 3 error(s), 0 warning(s)
> -------------------------------------------------------
>  I think I made my problem clear and I am expecting
> your reply....Thanks for  the previous reply...Ciao
> 
> Cheers
> 
> BeeJay
> 
> 
> 
> ________________________________________________________________________
> Yahoo! India Matrimony: Find your partner online.
> Go to http://yahoo . shaadi . com
>