Nóta
Teastaíonn údarú chun rochtain a fháil ar an leathanach seo. Is féidir leat triail a bhaint as shíniú isteach nó eolairí a athrú.
Teastaíonn údarú chun rochtain a fháil ar an leathanach seo. Is féidir leat triail a bhaint as eolairí a athrú.
templates cannot be declared to have 'C' linkage
Remarks
This error can be caused by a template defined inside an extern "C" block.
Examples
The following example generates C2894:
// C2894.cpp
extern "C" {
template<class T> class stack {}; // C2894 fail
template<class T> void f(const T &aT) {} // C2894
}
The following example generates C2894:
// C2894b.cpp
// compile with: /c
extern "C" template<class T> void f(const T &aT) {} // C2894
template<class T> void f2(const T &aT) {} // OK