void DestroyBodies(vector<CBody*> & bodies) { for (vector<CBody>::iterator it = bodies.begin(); it != bodies.end(); ++it) { delete *it; *it = NULL; } } 

What should I do? Displays errors

  • error C2259: 'CBody': cannot instantiate abstract class (this seems to be the whole problem)

and correspondingly:

  • error C2440: 'initializing': cannot convert from 'std :: _ Vector_iterator <_Ty, _Alloc>' to 'std :: _ Vector_iterator <_Ty, _Alloc>'
  • error C2679: binary '! =': no ​​operator found std :: _ Vector_iterator <_Ty, _Alloc> '(or there is no acceptable conversion)
  • error C2440: 'delete': cannot convert from 'CBody' to 'void *'

    1 answer 1

    In loop for, omitted * in vector<CBody>::iterator . But I guess this is not the problem. Lay out the class code CBody.

    • No, it turned out only in this) Thank you very much) - User