2

I have a namespace that gets built out of a .cpp and .h
lots of classes use this namespace and call the template functions from within it How do I fix all the undefined references during the linking process? Where would I put all the definitions of the template functions? could someone show me an example of a namespace that uses templates and then a class that uses that namespace and can successfully call one of the templated functions without error?

Trevor Hickey
  • 36,288
  • 32
  • 162
  • 271

1 Answers1

2

Most likely you're incorrectly placing template definitions in the .cpp file.

For more information about that, see the FAQ item "Why can't I separate the definition of my templates class from its declaration and put it inside a .cpp file?".

The immediately following FAQ items may also be of help to you, but it's not entirely clear what your question is about (in detail).

Cheers & hth.,

Cheers and hth. - Alf
  • 142,714
  • 15
  • 209
  • 331