Correction it does not work from main either. But I just needed to link against ITKNumerics in my CMakeLists.txt file.<br><br>Problem solved.<br><br><br><div class="gmail_quote">On Sat, Jun 20, 2009 at 12:11 PM, motes motes <span dir="ltr"><<a href="mailto:mort.motes@gmail.com">mort.motes@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">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>
</blockquote></div><br>