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&lt; PixelType, Dimension &gt; FixedImageType;<br>    typedef itk::Image&lt; PixelType, Dimension &gt; MovingImageType;<br>
    typedef itk::TranslationTransform&lt; double, Dimension &gt; TransformType;<br>    typedef itk::RegularStepGradientDescentOptimizer OptimizerType;<br>    typedef itk::MeanSquaresImageToImageMetric&lt; FixedImageType, MovingImageType &gt; MetricType;<br>
    typedef itk:: LinearInterpolateImageFunction&lt; MovingImageType, double &gt; InterpolatorType;<br>    typedef itk::ImageRegistrationMethod&lt;FixedImageType, MovingImageType &gt; 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 &quot;protected: virtual void __thiscall itk::CostFunction::PrintSelf(class std::basic_ostream&lt;char,struct std::char_traits&lt;char&gt; &gt; &amp;,class itk::Indent)const &quot; (?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>