Hello
I am getting an error when i am trying to instantiate an object of the
template based class
#include "foo.h"
int main()
{
CFoo<intmyFoo ;
return 1 ;
}
now I have 2 files
foo.h
---------------------------------------------------
template < class CFooTempclass CFoo
{
CFoo();
~CFoo() ;
};
foo.cpp
--------------------------------------------
#include "foo.h"
template < class CFooTemp>
CFoo<CFooTemp>::CFoo()
{
}
template < class CFooTemp>
CFoo<CFooTemp>::CFoo()
{
}
------------------------------------------------------------
I get the following errors
main.cpp:12: undefined reference to `CFoot<int>::CFoo()'
main.cpp:14: undefined reference to `CFoo<int>::~CFoo()'
However this error is not seen when i include "foo.cpp" instead of foo.h