Export (0) Print
Expand All
Expand Minimize

Compiler Error C2920

Error Message

redefinition : 'class' : type class has already been declared as 'identifier'

A generic or template class has multiple declarations, which are not equivalent.

The following sample generates C2920:

// C2920.cpp
// compile with: /c
typedef int TC1;
template <class T> 
struct TC1 {};   // C2920
struct TC2 {};   // OK

C2920 can also occur when using generics:

// C2920b.cpp
// compile with: /clr /c
typedef int GC1;
generic <class T> 
ref struct GC1 {};   // C2920
ref struct GC2 {};   // OK

Community Additions

ADD
Show:
© 2014 Microsoft