[Insight-developers] Re: [Insight-users] Fixing bugs for ITK with MinGW

Brad King brad.king at kitware.com
Wed Sep 5 08:51:04 EDT 2007


Ali - wrote:
> 
>  >
>  > The export syntax in Luis's patch was incorrect. Try this instead:
>  >
>  > template class ITKCommon_EXPORT
>  > itk::SmartPointerForwardReference<itk::ProcessObject>;
>  >
>  > -Brad
>  >
> 
> 
> Of course. This links the shared library, however, now the same old 
> problem is back again: the tests fail (see the end of this message). How 
> come this does not happen to visual studio?
> 
> 
> Linking CXX executable ../../bin/itkTestDriver.exe
> CMakeFiles/itkTestDriver.dir/itkTestDriver.obj:itkTestDriver.cxx:(.text$_ZN3itk15ImageFileWriterINS_5ImageIhLj2EEEE5WriteEv[itk::ImageFileWriter<itk::Image<unsigned 
> char, 2u> >::Write()]+0x12c7): undefined reference to 
> `itk::SmartPointerForwardReference<itk::ProcessObject>::operator 
> itk::ProcessObject*() const'

Try adding this line to the top of itkTestDriver.cxx, but after the 
#include lines:

extern template class ITKCommon_EXPORT 
itk::SmartPointerForwardReference<itk::ProcessObject>;

This will do the "dllimport" part.  VS has a different import mechanism 
that makes this "just work" for member functions, but if the class had 
some public static data members then this would be needed for VS too. 
If the above works then we will need to add it in 
itkSmartPointerForwardReference.h in the proper place with a few 
preprocessing guards.

-Brad


More information about the Insight-developers mailing list