I have this class:<br><br>class MyImgReg{<br>public:<br><br>    static const unsigned int Dimension = 2;<br>    typedef float PixelType;<br>    typedef itk::Image< PixelType, Dimension > FixedImageType;<br>    typedef itk::Image< PixelType, Dimension > MovingImageType;<br>
    typedef itk::TranslationTransform< double, Dimension > TransformType;<br>    typedef itk::RegularStepGradientDescentOptimizer OptimizerType;<br>    typedef itk::MeanSquaresImageToImageMetric< FixedImageType, MovingImageType > MetricType;<br>
    typedef itk:: LinearInterpolateImageFunction< MovingImageType, double > InterpolatorType;<br>    typedef itk::ImageRegistrationMethod<FixedImageType, MovingImageType > RegistrationType;<br><br>    void setupComponents(){<br>
        MetricType::Pointer metric = MetricType::New();<br><br>    }<br>};<br><br>I call it from main:<br><br>int main( int argc, char* argv[] ){<br>    MyImgReg reg;<br>    reg.setupComponents();<br>   return 0;<br>}<br>
<br>But get the error:<br><br>error LNK2001: unresolved external symbol "protected: virtual void __thiscall itk::CostFunction::PrintSelf(class std::basic_ostream<char,struct std::char_traits<char> > &,class itk::Indent)const " (?PrintSelf@CostFunction@itk@@MBEXAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@VIndent@2@@Z)<br>
<br>Using Visual Studio 2008.<br><br>I works fine if I just have everything in the main function, but I prefer to split things up in smaller chunks, any ideas?<br>