[Insight-users] Link-problems with my own itk-filter
Corinne Mattmann
mattmaco at ee . ethz . ch
Thu, 4 Dec 2003 09:38:04 -0700
Hi,
I want to create my own itk-filter but I have some problems making it
work!
I use Microsoft Visual C++ and I include the files (my txx- and h-file
from the filter and a testfile where I create an instance of my filter)
in my project with CMake:
ADD_EXECUTABLE(TestDeformableRegistrationFilter
TestDeformableRegistrationFilter.cxx
DeformableRegistrationFilter.txx
DeformableRegistrationFilter.h)
My filter is inherited from the ImageToImageFilter:
template < class TInputImage1, class TInputImage2, class
TOutputImage >
class ITK_EXPORT DeformableRegistrationFilter : public
ImageToImageFilter<TInputImage1,TOutputImage>
and I put everything in the "namespace itk".
Now my problems:
- If I compile my test-project (TestDeformableRegistrationFilter) it
doesn't report me any errors in my filter-files. But if I take out the
"namespace itk" I get compile errors. Why does my compiler not work
properly if I use "namespace itk"?
- The second problem is that (independent of using the namespace itk or
not) after compiling without errors, my project doesn't link. I guess it
can't find my protected Constructor (I use public: itkNewMacro(Self) in
my h-file). What am I doing wrong?
Here's the error I get:
Linking...
Creating library
D:\packwin\vtkMy\bin\bin\Debug/TestDeformableRegistrationFilter.lib and
object
D:\packwin\vtkMy\bin\bin\Debug/TestDeformableRegistrationFilter.exp
TestDeformableRegistrationFilter.obj : error LNK2001: unresolved
external symbol "protected: __thiscall
itk::DeformableRegistrationFilter<class itk::Image<char,3>,class
itk::Image<char,3>,class itk::Image<class itk::Vector<float,3>,3>
>::DeformableRegistrationFilter<class itk::Image<char,3>,class
itk::Image<char,3>,class itk::Image<class itk::Vector<float,3>,3>
>(void)"
(??0?$DeformableRegistrationFilter at V?$Image at D$02 at itk@@V12 at V?$Image at V?$Ve
ctor at M$02 at itk@@$02 at 2@@itk@@IAE at XZ)
D:\packwin\vtkMy\bin\bin\Debug/TestDeformableRegistrationFilter.exe :
fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Can anybody help me?
Thanks very much,
Corinne Mattmann