Antw: [Insight-users] (no subject) Linker problem with program that reads and writes an image

Jan Schreiber Jan.Schreiber at umit.at
Fri May 6 03:52:10 EDT 2005


Hi Björn, 

did you link with ITKCommon.lib and ITKIO.lib? 

In CMake, they are included with

CMakeLists.txt
...
LINK_LIBRARIES (
  ITKCommon
  ITKIO
)

There is am example program "ImageReadWrite" in the "Examples\IO" folder that simply reads and writes an image. 

Best regards, 
Jan


>>> "Björn Coenen" <BCoenen at gmx.net> 05.05.2005 23:36:56 >>>
HI, i am a startet with the itk toolkit and i just wanted to try the reading
and writing for images but the following code piece doesnt work. The visul
error message is following the code. It would be great to get an answer,
even if it must be a very easy problem for you all.

Bjoern coenen



#include "itkImage.h"
#include <iostream>
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"



void main( )
{
 

typedef unsigned short PixelType;
const unsigned int Dimension = 2;
typedef itk::Image< PixelType, Dimension > ImageType;

typedef itk::ImageFileReader< ImageType > ReaderType;
typedef itk::ImageFileWriter< ImageType > WriterType;

ReaderType::Pointer reader = ReaderType::New();
WriterType::Pointer writer = WriterType::New();


}

--------------------Configuration: test - Win32 Debug--------------------
Linking...
test.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)
test.obj : error LNK2001: unresolved external symbol "public: unsigned int
__thiscall itk::ImageIOBase::GetImageSizeInBytes(void)const "
(?GetImageSizeInBytes at ImageIOBase@itk@@QBEIXZ)
test.obj : error LNK2001: unresolved external symbol "class
std::basic_ostream<char,struct std::char_traits<char> > & __cdecl
itk::operator<<(class std::basic_ostream<char,struct std::char_traits<char>
> &,class itk::ImageIORegion const &)"
(??6itk@
@YAAAV?$basic_ostream at DU?$char_traits at D@std@@@std@@AAV12 at ABVImageIORegion@0@@Z)
test.obj : error LNK2001: unresolved external symbol "protected: virtual
void __thiscall itk::ImageIORegion::PrintSelf(class
std::basic_ostream<char,struct std::char_traits<char> > &,class
itk::Indent)const " (?PrintSelf at ImageIORegion@itk@@MBEXAAV?$
basic_ostream at DU?$char_traits at D@std@@@std@@VIndent at 2@@Z)
test.obj : error LNK2001: unresolved external symbol "public: void
__thiscall itk::ImageIOBase::SetNumberOfDimensions(unsigned int)"
(?SetNumberOfDimensions at ImageIOBase@itk@@QAEXI at Z)
test.obj : error LNK2001: unresolved external symbol "public: class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > __thiscall
itk::ImageIOBase::GetComponentTypeAsString(enum
itk::ImageIOBase::IOComponentType)const 
"
(?GetComponentTypeAsString at ImageIOBase@itk@@QBE?AV?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@W4IOComponentType at 12@@Z)
Debug/test.exe : fatal error LNK1120: 6 unresolved externals
Error executing link.exe.

test.exe - 7 error(s), 0 warning(s)

-- 
+++ Lassen Sie Ihren Gedanken freien Lauf... z.B. per FreeSMS +++
GMX bietet bis zu 100 FreeSMS/Monat: http://www.gmx.net/de/go/mail 
_______________________________________________
Insight-users mailing list
Insight-users at itk.org 
http://www.itk.org/mailman/listinfo/insight-users



More information about the Insight-users mailing list