[Insight-users] Re: Linking error - ProgressReporter

Reinhold Füreder R.Fureder@exeter.ac.uk
Tue, 8 Oct 2002 15:17:58 +0100


Hi again,

I would like to add some details about the problem I have:

It was compiling fine before I upgraded to the last CVS version of ITK. But
after upgrading I got the following error messages:
-----------------------------------------------------------------------
d:\yann\cvs\insight\code\common\itkimagefunction.h(61) : error C2039:
'GetImageDimension' : is not a member of 'itk'
        d:\yann\cvs\insight\code\common\itkimagefunction.h(181) : see
reference to class template instantiation
'itk::ImageFunction<TInputImage,TOutput,TCoordRep>' being compiled
d:\yann\cvs\insight\code\common\itkimagefunction.h(61) : error C2065:
'GetImageDimension' : undeclared identifier
        d:\yann\cvs\insight\code\common\itkimagefunction.h(181) : see
reference to class template instantiation
'itk::ImageFunction<TInputImage,TOutput,TCoordRep>' being compiled
d:\yann\cvs\insight\code\common\itkimagefunction.h(61) : error C2275:
'TInputImage' : illegal use of this type as an expression
        d:\yann\cvs\insight\code\common\itkimagefunction.h(181) : see
reference to class template instantiation
'itk::ImageFunction<TInputImage,TOutput,TCoordRep>' being compiled
d:\yann\cvs\insight\code\common\itkimagefunction.h(61) : error C2039:
'ImageDimension' : is not a member of 'Point'
        d:\yann\cvs\insight\code\common\itkpoint.h(209) : see declaration of
'Point'
        d:\yann\cvs\insight\code\common\itkimagefunction.h(181) : see
reference to class template instantiation
'itk::ImageFunction<TInputImage,TOutput,TCoordRep>' being compiled
d:\yann\cvs\insight\code\common\itkimagefunction.h(61) : error C2065:
'ImageDimension' : undeclared identifier
        d:\yann\cvs\insight\code\common\itkimagefunction.h(181) : see
reference to class template instantiation
'itk::ImageFunction<TInputImage,TOutput,TCoordRep>' being compiled
d:\yann\cvs\insight\code\common\itkimagefunction.h(62) : error C2143: syntax
error : missing ',' before '>'
        d:\yann\cvs\insight\code\common\itkimagefunction.h(181) : see
reference to class template instantiation
'itk::ImageFunction<TInputImage,TOutput,TCoordRep>' being compiled
d:\yann\cvs\insight\code\common\itkimagefunction.h(62) : error C2059: syntax
error : '>'
        d:\yann\cvs\insight\code\common\itkimagefunction.h(181) : see
reference to class template instantiation
'itk::ImageFunction<TInputImage,TOutput,TCoordRep>' being compiled

..... (and so on)
-----------------------------------------------------------------------

Therefore I added an include to MY file which was compiling after receiving
the above error message to explicitly know the "GetImageDimension", which is
declared in the itkImageBase class:
-----------------------------------------------------------------------
#include <itkImageBase.h>
-----------------------------------------------------------------------

Afterwards the GetImageDimension is well known but I receive the linking
error of my first e-mail (which is quoted at the bottom of this e-mail too).

The definition of the GetImageDimension (see below) mentions a bug in MSVC,
which I am currently using. So maybe there is a solution with regard to this
work-around???

-----------------------------------------------------------------------
/**
 * Due to a bug in MSVC, an enum value cannot be accessed out of a template
 * parameter until the template class opens.  In order for templated classes
 * to access the dimension of an image template parameter in defining their
 * own dimension, this class is needed as a work-around.
 */
template <typename TImage>
struct GetImageDimension
{
  itkStaticConstMacro(ImageDimension, unsigned int, TImage::ImageDimension);
};

-----------------------------------------------------------------------

Thanks a lot for your help,
    Reinhold


----- Original Message -----
From: "Reinhold Füreder" <R.Fureder@exeter.ac.uk>
To: <insight-users@public.kitware.com>
Sent: Monday, October 07, 2002 5:35 PM
Subject: [Insight-users] Linking error - ProgressReporter


> Hi,
>
> I have troubles compiling the project after getting the lattest CVS
> version of ITK (which was built successful - are the build options
> somehow helpful?). Although the necessary library (ITKCommon.lib) is
> included I receive the error message below.
>
> Could anyone help me with my C++ or ITK problem?
>
> Thanks,
>     Reinhold
>
> ----------------------------------------------------------------------
> Linking... Creating library
> ..\bin\Debug\OurProjectUsingITK.lib and object
> ..\bin\Debug\OurProjectUsingITK.exp DownsampleFilterInterface.obj :
> error LNK2001: unresolved external symbol "public: __thiscall
> itk::ProgressReporter::~ProgressReporter(void)"
> (??1ProgressReporter@itk@@QAE@XZ)
> ThresholdAlgorithmInterfaceCommand.obj : error LNK2001: unresolved
> external symbol "public: __thiscall
> itk::ProgressReporter::~ProgressReporter(void)"
> (??1ProgressReporter@itk@@QAE@XZ) DownsampleFilterInterface.obj :
> error LNK2001: unresolved external symbol "public: __thiscall
> itk::ProgressReporter::ProgressReporter(class
> ProgressReporter::ProcessObject *,int,unsigned long,unsigned long)"
> (??0ProgressReporter@itk@@QAE@PAVProces sObject@1@HKK@Z)
> ThresholdAlgorithmInterfaceCommand.obj : error LNK2001: unresolved
> external symbol "public: __thiscall
> itk::ProgressReporter::ProgressReporter(class
> ProgressReporter::ProcessObject *,int,unsigned long,unsigned long)"
> (??0ProgressReporter@itk@@QAE@ PAVProcessObject@1@HKK@Z)
> ..\bin\Debug\OurProjectUsingITK.exe : fatal error LNK1120: 2
> unresolved externals Error executing link.exe.
>
> OurProjectUsingITK.exe - 5 error(s), 0 warning(s)
> ----------------------------------------------------------------------
> Object/Lib modules: kernel32.lib user32.lib gdi32.lib winspool.lib
> comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
> odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib
> wxmswd.lib pngd.lib zlibd.lib jpegd.lib tiffd.lib wxxrcd.lib
> ITKBasicFilters.lib ITKCommon.lib VXLNumerics.lib ITKIO.lib MetaIO.lib
> itkpng.lib itkzlib.lib fld.lib
> ----------------------------------------------------------------------
>
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-users
>