Compiler Error C2976

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Compiler Error C2976.

identifier' : too few type arguments

A generic or template is missing one or more actual arguments. Check the generic or template declaration to find the correct number of parameters.

This error can be caused by missing template arguments in STL components.

The following sample generates C2976:

// C2976.cpp  
template <class T>   
struct TC {  
   T t;  
};  
int main() {  
   TC<>* t;   // C2976  
   TC<int>* t2;   // OK  
}  

C2976 can also occur when using generics:

// C2976b.cpp  
// compile with: /clr  
generic <class T>  
ref struct GC {  
   T t;  
};  
  
int main() {  
   GC<>^ g;   // C2976  
   GC<int>^ g2;   // OK  
}  

Show: