[Insight-users] Problem: Integrating ITK in an existing Project (VS 2005, C++) (error LNK2001)

Chris Duwenkamp cduwenkamp at gmx.de
Tue Nov 27 08:02:04 EST 2007


Hello,

I am trying to integrate ITK in an existing C++-project.

Therefor I have done the following steps:

1. downloading & decompress ITK 3.4.0
2. download C-Make 2.4
3. Build ITK with C-Make like described in the user guide

until this step everything went fine, ITK build properly and the build 
examples could be executet.

But now i have to integrate the ITK librarys in my existing project and 
thats where my problem is.
Normaly as described in the user guide you should use C-Make to create 
the project file, but hence my project is still existing I tried to set 
the neccessary project settings manully.

Therefor I have done the the following:

5. defined the systemvariables %ITK% and %ITK_BINARY% with the path to 
the ITK-source code and the directory i have build ITK in. (in my case 
%ITK% = C:\prog\dev\InsightToolkit-3.4.0 , %ITK_BINARY% = 
C:\prog\dev\itk_binary )

6. Added to "Configure Properties -> C/C++ -> General -> Additional 
Include Directories" the following directories:

$(ITK_BINARY);
$(ITK)\Code\Algorithms;
$(ITK)\Code\BasicFilters;
$(ITK)\Code\Common;
$(ITK)\Code\Numerics;
$(ITK)\Code\IO;
$(ITK)\Code\Numerics\FEM;
$(ITK)\Code\Numerics\Statistics;
$(ITK)\Code\Numerics\NeuralNetworks;
$(ITK)\Code\SpatialObject;
$(ITK)\Utilities\MetaIO;
$(ITK)\Utilities\NrrdIO;
$(ITK)\Utilities\DICOMParser;
$(ITK_BINARY)\Utilities\DICOMParser;
$(ITK_BINARY)\Utilities\expat;
$(ITK)\Utilities\expat;
$(ITK)\Utilities\nifti\niftilib;
$(ITK)\Utilities\nifti\znzlib;
$(ITK)\Utilities\itkExtHdrs;
$(ITK_BINARY)\Utilities;
$(ITK)\Utilities;
$(ITK_BINARY)\Code\Common;
$(ITK)\Utilities\vxl\vcl;
$(ITK)\Utilities\vxl\core;
$(ITK_BINARY)\Utilities\vxl\vcl;
$(ITK_BINARY)\Utilities\vxl\core;
$(ITK_BINARY)\Utilities\gdcm;
$(ITK)\Utilities\gdcm\src;
$(ITK)\Utilities\vxl\v3p\netlib;

7. Added under Linker->General->Additional Library Directories the 
Directory:

$(ITK_BINARY)\bin\debug

8. Added under Linker->Input->Additional Dependencies  the following libs:

ITKIO.lib
 ITKNrrdIO.lib
 itkgdcm.lib
 itkjpeg12.lib
 itkjpeg16.lib
 itkopenjpeg.lib 
 itkpng.lib
 itktiff.lib
 itkjpeg8.lib
 ITKSpatialObject.lib
 ITKCommon.lib
 itkvnl_inst.lib
 itkvnl_algo.lib
 itkv3p_netlib.lib
 itkvnl.lib
 itkvcl.lib
 ITKMetaIO.lib
 itksys.lib 
 ITKDICOMParser.lib
 ITKEXPAT.lib
 ITKniftiio.lib
 ITKznz.lib
 itkzlib.lib
kernel32.lib
 user32.lib
 gdi32.lib
 winspool.lib
 shell32.lib
 ole32.lib
 oleaut32.lib
 uuid.lib
 comdlg32.lib
 advapi32.lib 
 snmpapi.lib
 comctl32.lib
 wsock32.lib

9. There i thought I have configured everything and wanted to try it 
out, therefore i pasted the following code in one of my classes:

    typedef itk::Image< unsigned short, 3 > ImageType;       
    ImageType::Pointer image = ImageType::New();

and included  "itkImage.h" .

10. The compiling went well and no errors showed but when I tryed to 
build the project i got the following link-error :

ImportManager.obj : error LNK2001: unresolved external symbol "public: 
virtual void __thiscall itk::HRGN::Print(class 
std::basic_ostream<char,struct std::char_traits<char> > &,class 
itk::Indent)const " 
(?Print at HRGN@itk@@UBEXAAV?$basic_ostream at DU?$char_traits at D@std@@@std@@VIndent at 2@@Z)
ImportManager.obj : error LNK2001: unresolved external symbol 
"protected: virtual void __thiscall itk::HRGN::PrintHeader(class 
std::basic_ostream<char,struct std::char_traits<char> > &,class 
itk::Indent)const " 
(?PrintHeader at HRGN@itk@@MBEXAAV?$basic_ostream at DU?$char_traits at D@std@@@std@@VIndent at 2@@Z)
ImportManager.obj : error LNK2001: unresolved external symbol 
"protected: virtual void __thiscall itk::HRGN::PrintTrailer(class 
std::basic_ostream<char,struct std::char_traits<char> > &,class 
itk::Indent)const " 
(?PrintTrailer at HRGN@itk@@MBEXAAV?$basic_ostream at DU?$char_traits at D@std@@@std@@VIndent at 2@@Z)
ImportManager.obj : error LNK2001: unresolved external symbol 
"protected: virtual void __thiscall itk::HRGN::PrintSelf(class 
std::basic_ostream<char,struct std::char_traits<char> > &,class 
itk::Indent)const " 
(?PrintSelf at HRGN@itk@@MBEXAAV?$basic_ostream at DU?$char_traits at D@std@@@std@@VIndent at 2@@Z)
ImportManager.obj : error LNK2001: unresolved external symbol "public: 
static double const itk::NumericTraits<double>::Zero" 
(?Zero@?$NumericTraits at N@itk@@2NB)

Did I forget to include something ?

Thanks a lot for yiur help,

Chris

(PS: excuse my bad spelling, but english is not my nativ language)


More information about the Insight-users mailing list