Expand Minimize
1 out of 2 rated this helpful - Rate this topic

Compiler Error C2989

Error Message

'class' : class type has already been declared as a non-class type

The class generic or template redefines a non-template or non-generic class. Check header files for conflicts.

If you are using class template partial specializations, see Knowledge Base article Q240866.

For more information, see the Knowledge Base article Q240866. You can find Knowledge Base articles on the MSDN Library CD-ROM or at http://support.microsoft.com/support/.

The following sample generates C2989:

// C2989.cpp
// compile with: /c
class C{};

template <class T>
class C{};  // C2989
class C2{};

C2989 can also occur when using generics:

// C2989b.cpp
// compile with: /clr /c
ref class GC1;

generic <typename T> ref class GC1;   // C2989
template <typename T> ref class GC2;

generic <typename T> ref class GC2;   // C2989
generic <typename T> ref class GCb;
template <typename T> ref class GC2;
generic <typename T> ref class GCc;
Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.