Re: Calling a static class-member template function
On Feb 2, 7:35 pm, Olumide <50...@web.de> wrote:
I've got a static class member function
MyClass{
public:
template <typename T> static void converter( list<T > &, vector<T
& );
};
template <typename T> void VTK_Writer::converter( list<T > &lst,
vector<T > &vec )
{
// does weird and wonderful stuff
}
It compiles well. However, when I try to call/use this function as
such,
main( )
{
list<int > A;
vector<int > B;
MyClass::converter( A, B ); // E R R O R
}
The Microsoft C++ compiler "rewards" me with the linker error
LNK2019. What am I doing wrong?
The obvious answer that people like to give around here is to
quote the FAQ where it says, give us an exact, compilable
example which reproduces the problem. In this case, it's
possible with some exterpolation (e.g. that the error LNK2019
means "unresolved external") to guess that maybe you've put the
function definition in a source file, rather than include it in
the translation unit in which it is used. VC++, like a number
of other compilers, will not find it in this case, and the
linker will complain.
But as I said, it's just a guess. (It just happens to be such a
frequent error that one assumes it in such cases.)
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34