[Insight-users] Re: Help on link error with a template function
Ritesh Bafna
riteshramesh-bafna at uiowa.edu
Wed Dec 20 13:07:38 EST 2006
Hi Sam,
You need to call your function in this way :
myPyramid<InputArray2D, FloatArray2D >( inputImageArray2D,
outputImageArray2D, (unsigned
int)lWidth, (unsigned int)lHeight ) ;
Ritesh
[Hide Quoted Text]
----------------------------------------------------------------------
Message: 1
Date: Wed, 20 Dec 2006 11:12:58 -0500
From: "Sam" <sd2usa at gmail.com>
Subject: [Insight-users] Help on link error with a template function
To: <insight-users at itk.org>
Cc: sd2usa at 163.com
Message-ID: <45896103.3c95e047.7bb9.ffff8abd at mx.google.com>
Content-Type: text/plain; charset="us-ascii"
Dear ITK developers and users;
I defined a template function:
template<class InputArrayType, class OutputArrayType>
void myPyramid(itk::Array2D< InputArrayType > in, itk::Array2D<
OutputArrayType > out, unsigned int nColumns, unsigned int nRows) ;
and used it in the main file:
typedef signed short InputPixelType;
typedef itk::Array2D< InputPixelType > InputArray2D ;
InputArray2D inputImageArray2D( lWidth, lHeight ) ;
typedef itk::Array2D< float > FloatArray2D ;
FloatArray2D outputImageArray2D( lWidth/2, lHeight/2 ) ;
myPyramid( inputImageArray2D, outputImageArray2D, (unsigned
int)lWidth, (unsigned int)lHeight ) ;
but a link error displays:
DicomImageReadWrite.obj : error LNK2019: unresolved external symbol "void
__cdecl myPyramid(class itk::Array2D<short>,class
itk::Array2D<float>,unsigned int,unsigned int)"
(?myPyramid@@YAXV?$Array2D at F@itk@@V?$Array2D at M@2 at II@Z) referenced in
function _main
Debug\DicomImageReadWrite.exe : fatal error LNK1120: 1 unresolved externals
Would you please help me to find where the problem is and how to fix it?
Your kind help is greatly appreciated.
Best regards,
Sam
More information about the Insight-users
mailing list