Compiler Error C2541

 

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 C2541.

delete' : delete : cannot delete objects that are not pointers

The delete operator was used on an object that is not a pointer.

The following sample generates C2541:

// C2541.cpp  
int main() {  
   int i;  
   delete i;   // C2541 i not a pointer  
  
   // OK  
   int *ip = new int;  
   delete ip;  
}  

Show: