Re: [Insight-users] Problem: Integrating ITK in an existing Project (VS 2005, C++) (error LNK2001)
Paweł Andruszkiewicz
pandruszkiewicz at o2.pl
Wed Nov 28 04:48:37 EST 2007
Hello Chris
I'm using ITK in similar circumstances as you, so VS 2005/2008 with older project which cannot use CMake. I did all the steps of compiling the ITK in the same manner as you, however I've turned off BUILD_EXAMPLES, BUILD_SHARED_LIBS and BUILD_TESTING. My VS project settings are just like yours (if you want I can post them), but I don't have the problem described. I'm not an ITK expert, but I've searched the files of ITK for word "HRGN" and it does not exist there (HRGN is a windows type, not an ITK class). Maybe you have a misplaced namespace somewhere in your project?
kind regards, Pawel Andruszkiewicz
Dnia 27 listopada 2007 14:02 Chris Duwenkamp <cduwenkamp at gmx.de> napisał(a):
> 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 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 > &,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 > &,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 > &,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 > &,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::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)
> _______________________________________________
> 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