Compiler Error C2894

templates cannot be declared to have 'C' linkage

Templates cannot be declared with “C” linkage. This error is generated when a template is defined inside an extern “C” block. For example:

extern “C” {
   template<class T> class stack {   //error
   };
   template<class T> void f(const T &aT){} //error
}

and

extern “C” template<class T> void f(const T &aT) {} //error