These are my files:
--------[ c.hpp ]--------
#ifndef _C
#define _C
#include
class C
{
public:
template void ca
I believe this is because when you compile c.cpp
the compiler doesn't know it needs to generate code for C::call
, and when you're compiling main.cpp
it doesn't have the definition of C::call
from which to instantiate C::call
.
Template definitions are essentially semantic macros, so much like the preprocessor's #define
lexical macros they must be visible in the compilation units that use them.