[Insight-users] multiple definition error

Baoyun Li baoyun_li123 at yahoo.com
Wed May 26 12:52:49 EDT 2010


Dear All:
 
I want to add a small function into one of my template implemtation txx or cxx file. Before I add haha123(), I have no problem to build and run the project. After I add void haha123() into my txx file, I had multiple defintion error at the link stage.
 
Belows are my .h file and .txx file for the template function. Can somebody teach me  how to figure out this problem.
 
Thanks
 
baoyun
 
############################my header file######################
 
#ifndef _EmGmm_H
#define _EmGmm_H
 
 
#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif
 
#ifdef __BORLANDC__
#define ITK_LEAN_AND_MEAN
#endif
 
 
#include "itkNumericTraits.h" 
 
 
 
template <int maximumnumberiteration,class TInputFilter,class TOutputFilter,class ParametersType,class PrototionType>
void EmGmm( typename TInputFilter::Pointer& inputfilter,typename TOutputFilter::Pointer& labelreference,typename TOutputFilter::Pointer& outputfilter,std::vector<ParametersType>& initialparameters,PrototionType& initialProportions,std::string savedir);
 
#ifndef ITK_MANUAL_INSTANTIATION
 #include "EmGmm.txx"
 
#endif
 
#endif
 
 
############################my TXX file##################
#ifndef _EmGmm_TXX
#define _EmGmm_TXX
#include "EmGmm.h"
 
void haha123()
 
{
 ;
 
}
 
template <int maximumnumberiteration,class TInputFilter,class TOutputFilter,class ParametersType,class PrototionType>
void EmGmm( typename TInputFilter::Pointer& inputfilter,typename TOutputFilter::Pointer& labelreference,typename TOutputFilter::Pointer& outputfilter,std::vector<ParametersType>& initialparameters,PrototionType& initialProportions,std::string savedir)
{
  
  ///// implementation of the function
 // want to call void haha123
 
}
 
 
 
#endif
 


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100526/c46053c1/attachment-0001.htm>


More information about the Insight-users mailing list