0

I want to define a member template function in a class that is not a template class. If I access it from another class, the compiler gives undefined reference error. How do I fix this problem without adding the implementation in the .h file ?

svp
  • 1
  • 1
    TL;DR - you can't. The definition of a template function must be available in every translation unit that uses this function (unless you provide explicit instantiations). This is generally only done by moving the definition to header file. – Yksisarvinen Mar 30 '22 at 12:42

0 Answers0