<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><DIV>Dear All:</DIV>
<DIV> </DIV>
<DIV>I want to add a small function into one of my template implemtation txx or cxx file. Before I add h<FONT face="Times New Roman">aha123(), I have no problem to build and run the project. After I add void haha123() into my txx file, I </FONT>had multiple defintion error at the link stage.</DIV>
<DIV> </DIV>
<DIV>Belows are my .h file and .txx file for the template function. Can somebody teach me how to figure out this problem.</DIV>
<DIV> </DIV>
<DIV>Thanks</DIV>
<DIV> </DIV>
<DIV>baoyun</DIV>
<DIV> </DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">############################my header file######################</FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p><FONT face="Times New Roman"> </FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">#ifndef _EmGmm_H<o:p></o:p></FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">#define _EmGmm_H<o:p></o:p></FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman"> </FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman"> </FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">#if defined(_MSC_VER)<o:p></o:p></FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">#pragma warning ( disable : 4786 )<o:p></o:p></FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">#endif<o:p></o:p></FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman"> </FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">#ifdef __BORLANDC__<o:p></o:p></FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">#define ITK_LEAN_AND_MEAN<o:p></o:p></FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">#endif<o:p></o:p></FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman"> </FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman"> </FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">#include "itkNumericTraits.h" <o:p></o:p></FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman"> </FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman"> </FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman"> </FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">template <int maximumnumberiteration,class TInputFilter,class TOutputFilter,class ParametersType,class PrototionType><o:p></o:p></FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">void EmGmm( typename TInputFilter::Pointer& inputfilter,typename TOutputFilter::Pointer& labelreference,typename TOutputFilter::Pointer& outputfilter,std::vector<ParametersType>& initialparameters,PrototionType& initialProportions,std::string savedir);<o:p></o:p></FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman"> </FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">#ifndef ITK_MANUAL_INSTANTIATION<o:p></o:p></FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes"> </SPAN>#include "EmGmm.txx"<o:p></o:p></FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman"> </FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">#endif<o:p></o:p></FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman"> </FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">#endif</FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman"> </FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman"> </FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">############################my TXX file##################</FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">#ifndef _EmGmm_TXX<o:p></o:p></FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">#define _EmGmm_TXX<o:p></o:p></FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">#include "EmGmm.h"<o:p></o:p></FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman"> </FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">void haha123()<o:p></o:p></FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman"> </FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">{<o:p></o:p></FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes"> </SPAN>;<o:p></o:p></FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman"> </FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">}<o:p></o:p></FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman"> </FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">template <int maximumnumberiteration,class TInputFilter,class TOutputFilter,class ParametersType,class PrototionType><o:p></o:p></FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">void EmGmm( typename TInputFilter::Pointer& inputfilter,typename TOutputFilter::Pointer& labelreference,typename TOutputFilter::Pointer& outputfilter,std::vector<ParametersType>& initialparameters,PrototionType& initialProportions,std::string savedir)<o:p></o:p></FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">{<o:p></o:p></FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes"> </SPAN><o:p></o:p></FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes"> </SPAN>///// implementation of the function<o:p></o:p></FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes"> </SPAN>// want to call void haha123<o:p></o:p></FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman"> </FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">}<o:p></o:p></FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman"> </FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman"> </FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman"> </FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman">#endif</FONT></DIV>
<DIV> </DIV></td></tr></table><br>