Hi,everyone:<br><br>Can I use ITK code as a encapsulation function or class?<br>After encapsulation function, it maybe only easily to use ITK function as <br>general call function.<br><br>What should I do?<br><br>Note :
<br>I refer to InsightApplication/ITKFilterLib<div>/ and build this project.<br>It can generate a .lib file.<br>But when I test this lib separately,<br>the code<br>itkFilterLib filter(inputDimSize, inputOrigin, inputSpacing);
<br>
has a link error as below:<br>How should I solve this problem?<br><br>=====================================================<br>--------------------Configuration: ITKFilterLibTest - Win32 Debug--------------------<br>Linking...
<br>msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: __thiscall std::ios_base::Init::Init(void)" (??0Init@ios_base@std@@QAE@XZ) already defined in libcpd.lib(iostream.obj)<br>msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: __thiscall std::ios_base::Init::~Init(void)" (??1Init@
ios_base@std@@QAE@XZ) already defined in libcpd.lib(iostream.obj)<br>msvcprtd.lib(MSVCP60D.dll)
: error LNK2005: "public: __thiscall std::_Winit::_Winit(void)"
(??0_Winit@std@@QAE@XZ) already defined in libcpd.lib
(wiostrea.obj)<br>msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public:
__thiscall std::_Winit::~_Winit(void)" (??1_Winit@std@@QAE@XZ) already
defined in libcpd.lib(wiostrea.obj)<br>msvcprtd.lib(MSVCP60D.dll) :
error LNK2005: "public: __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char>
>::~basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >(void)" (??1?$basic_strin
<br>g@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in ITKFilterLibTest.obj<br>msvcprtd.lib(MSVCP60D.dll)
: error LNK2005: "public: char const * __thiscall
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >::c_str(void)const "
(?c_str@?$basic_string@
DU?$char_traits@D@std@@V?$allocator@D@2@@std@@Q<br>BEPBDXZ) already defined in ITKFilterLibTest.obj<br>msvcprtd.lib(MSVCP60D.dll)
: error LNK2005: "class std::basic_ostream<char,struct
std::char_traits<char> > & __cdecl
std::operator<<(class std::basic_ostream<char,struct
std::char_traits<char> > &,char const *)" (??6std@@
YAAAV?$basic_ostream@DU?$cha<br>r_traits@D@std@@@0@AAV10@PBD@Z) already defined in ITKFilterLibTest.obj<br>msvcprtd.lib(MSVCP60D.dll)
: error LNK2005: "public: virtual __thiscall
std::basic_ios<char,struct std::char_traits<char>
>::~basic_ios<char,struct std::char_traits<char>
>(void)" (??1?$basic_ios@
DU?$char_traits@D@std@@@std@@UAE@XZ) already defined <br>in libcpd.lib(iostream.obj)<br>msvcprtd.lib(MSVCP60D.dll)
: error LNK2005: "protected: __thiscall std::basic_ios<char,struct
std::char_traits<char> >::basic_ios<char,struct
std::char_traits<char> >(void)" (??0?$basic_ios@
DU?$char_traits@D@std@@@std@@IAE@XZ) already defined in lib<br>cpd.lib(iostream.obj)<br>msvcprtd.lib(MSVCP60D.dll)
: error LNK2005: "public: class std::basic_ostream<char,struct
std::char_traits<char> > & __thiscall
std::basic_ostream<char,struct std::char_traits<char>
>::operator<<(float)" (??6?$basic_ostream@
DU?$char_traits@D@std@@@s<br>td@@QAEAAV01@M@Z) already defined in ITKFilterLibTest.obj<br>msvcprtd.lib(MSVCP60D.dll)
: error LNK2005: "public: class std::basic_ostream<char,struct
std::char_traits<char> > & __thiscall
std::basic_ostream<char,struct std::char_traits<char>
>::operator<<(class std::basic_ostream<char,struct
std::char_traits
<br><char> > & (__cdecl*)(class
std::basic_ostream<char,struct std::char_traits<char> >
&))"
(??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z)
already defined in ITKFilterLibTest.obj<br>msvcprtd.lib(MSVCP60D.dll) : error LNK2005:
"class std::basic_ostream<char,struct std::char_traits<char>
> & __cdecl std::endl(class std::basic_ostream<char,struct
std::char_traits<char> > &)" (?endl@std@@
YAAAV?$basic_ostream@DU?$char_traits@D@std@@<br>@1@AAV21@@Z) already defined in ITKFilterLibTest.obj<br>msvcprtd.lib(MSVCP60D.dll)
: error LNK2005: "public: class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >
& __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char>
>::operator=(ch
<br>ar const *)"
(??4?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@PBD@Z)
already defined in libcpd.lib(locale0.obj)<br>msvcprtd.lib(MSVCP60D.dll)
: error LNK2005: "public: __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char>
>::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >(class std::allocator<char
<br>> const &)"
(??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV?$allocator@D@1@@Z)
already defined in ITKFilterLibTest.obj<br>msvcprtd.lib(MSVCP60D.dll) :
error LNK2005: "public: class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >
& __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char>
>::operator=(cl
<br>ass std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >
const &)"
(??4?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@ABV01@@Z)
already defined in ITKFilterLibTest.obj<br>msvcprtd.lib(MSVCP60D.dll) : error LNK2005:
"public: class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >
& __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char>
>::operator+=(c
<br>lass std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >
const &)"
(??Y?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@ABV01@@Z) already defined in
libcpd.lib(locale.obj)<br>msvcprtd.lib(MSVCP60D.dll)
: error LNK2005: "public: __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char>
>::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >(char const *,class std::a
<br>llocator<char> const &)"
(??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBDABV?$allocator@D@1@@Z)
already defined in ITKFilterLibTest.obj<br>MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: "public: virtual __thiscall exception::~exception(void)" (??1exception@@
UAE@XZ) already defined in LIBCD.lib(stdexcpt.obj)<br>MSVCRTD.lib(MSVCRTD.dll)
: error LNK2005: "public: __thiscall exception::exception(void)"
(??0exception@@QAE@XZ) already defined in LIBCD.lib(stdexcpt.obj)<br>
MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: "public: int __thiscall
type_info::operator==(class type_info const &)const "
(??8type_info@@QBEHABV0@@Z) already defined in LIBCD.lib(typinfo.obj)<br>LINK : warning LNK4098: defaultlib "MSVCRTD" conflicts with use of other libs; use /NODEFAULTLIB:library
<br>Example_ITKFilterLib.lib(ITKFilterLib.obj) : error LNK2001:
unresolved external symbol "public: static void __cdecl
itk::LightObject::operator delete(void *)"
(??3LightObject@itk@@SAXPAX@Z)<br>Example_ITKFilterLib.lib(
ITKFilterLib.obj) : error LNK2001: unresolved external symbol "public:
static void * __cdecl itk::LightObject::operator new(unsigned int)"
(??2LightObject@itk@@SAPAXI@Z)<br>Example_ITKFilterLib.lib(ITKFilterLib.obj
) : error LNK2001: unresolved external symbol "protected: virtual void __thiscall itk::ProcessObject::RestoreInputReleaseDataFlags(void)" (?RestoreInputReleaseDataFlags@ProcessObject@itk@@MAEXXZ)<br>Example_ITKFilterLib.lib(
ITKFilterLib.obj) : error LNK2001: unresolved external symbol
"protected: virtual void __thiscall itk::ProcessObject::CacheInputReleaseDataFlags(void)" (?CacheInputReleaseDataFlags@ProcessObject@itk@@MAEXXZ)<br>
Example_ITKFilterLib.lib(ITKFilterLib.obj) : error LNK2001: unresolved
external symbol "protected: virtual void __thiscall
itk::ProcessObject::PropagateResetPipeline(void)" (?PropagateResetPipeline@ProcessObject@itk
@@MAEXXZ)<br>Example_ITKFilterLib.lib(ITKFilterLib.obj)
: error LNK2001: unresolved external symbol "protected: virtual void
__thiscall itk::ProcessObject::GenerateOutputInformation(void)" (?GenerateOutputInformation@
ProcessObject@itk@@MAEXXZ)<br>Example_ITKFilterLib.lib(ITKFilterLib.obj)
: error LNK2001: unresolved external symbol "protected: virtual void
__thiscall itk::ProcessObject::GenerateOutputRequestedRegion(class itk::DataObject *)" (?GenerateOutputRequestedRegion@
ProcessObject@itk@<br>@MAEXPAVDataObject@2@@Z)<br>.<br>.<br>.<br>.<br><br><br></div>