[Insight-developers] Problem using RegisterOverride under Cygwin

Parag Chandra chandra@cs.unc.edu
Thu, 25 Jan 2001 13:59:17 -0500


This is a multi-part message in MIME format.

------=_NextPart_000_0163_01C086D7.01EFFE90
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi,
I am trying to use ObjectFactoryBase::RegisterOverride to specify a =
different method of object instantiation than the default one that is =
provided (I need this so that I can instantiate objects based on a key =
value). In the constructor of my specialized factory (which is derived =
from ObjectFactoryBase), I have:

RegisterOverride("mhd", "FileIOMetaImage", "Create FileIOMetaImage", =
true, CreateObjectFunction<FileIOMetaImage>::New());

which works fine under VC++. However, when I try to compile the same =
class under Cygwin, I get the following error:

/cygdrive/d/development/Insight/Code/Common/itkCreateObjectFunction.h: =
In method
 `class itk::SmartPointer<itk::LightObject> =
itk::CreateObjectFunction<itk::FileI
OMetaImage>::CreateObject()':
/cygdrive/d/development/Insight/Code/Common/itkProcessObject.h:350:   =
instantiat
ed from here
/cygdrive/d/development/Insight/Code/Common/itkCreateObjectFunction.h:76:=
 conver
sion from `itk::SmartPointer<itk::FileIOMetaImage>' to non-scalar type =
`itk::Sma
rtPointer<itk::LightObject>' requested

Does anyone know why only Cygwin (and possibly all g++ compilers) =
complains while VC++ does not?

Thanks,
-Parag Chandra

------=_NextPart_000_0163_01C086D7.01EFFE90
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4611.1300" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I am trying to use=20
ObjectFactoryBase::RegisterOverride to specify a different method of =
object=20
instantiation than the default one that is provided (I need this so that =
I can=20
instantiate objects based on a key value). In the constructor of my =
specialized=20
factory (which is derived from ObjectFactoryBase), I have:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>RegisterOverride("mhd", =
"FileIOMetaImage", "Create=20
FileIOMetaImage",&nbsp;true,&nbsp;CreateObjectFunction&lt;FileIOMetaImage=
&gt;::New());<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>which works fine under VC++. However, =
when I try to=20
compile the same class&nbsp;under Cygwin, I get the following=20
error:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial=20
size=3D2>/cygdrive/d/development/Insight/Code/Common/itkCreateObjectFunct=
ion.h: In=20
method<BR>&nbsp;`class itk::SmartPointer&lt;itk::LightObject&gt;=20
itk::CreateObjectFunction&lt;itk::FileI<BR>OMetaImage&gt;::CreateObject()=
':<BR>/cygdrive/d/development/Insight/Code/Common/itkProcessObject.h:350:=
&nbsp;&nbsp;=20
instantiat<BR>ed from=20
here<BR>/cygdrive/d/development/Insight/Code/Common/itkCreateObjectFuncti=
on.h:76:=20
conver<BR>sion from `itk::SmartPointer&lt;itk::FileIOMetaImage&gt;' to=20
non-scalar type `itk::Sma<BR>rtPointer&lt;itk::LightObject&gt;'=20
requested</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Does anyone know why only Cygwin (and =
possibly all=20
g++ compilers) complains while VC++ does not?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>-Parag =
Chandra</DIV></FONT></BODY></HTML>

------=_NextPart_000_0163_01C086D7.01EFFE90--