Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

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:
© 2015 Microsoft