Destructor causes compiler error with hard exit?

This is a discussion on Destructor causes compiler error with hard exit? within the C++ Programming forums, part of the General Programming Boards category; If I hard exit the debug version of my exe, I get a compiling error from class destructors that havn't ...

Destructor causes compiler error with hard exit?

If I hard exit the debug version of my exe, I get a compiling error from class destructors that havn't been called yet. Does this mean I have built the destructors wrong, or is it normal because the program quit before the destructor would have been called under normal conditions?

Any error that occurs after your program starts is a run-time error, not a compile-time error.
You haven't described what you mean by "hard exit".
There is nothing in such a simple mocked up code snippet that tells us anything remotely useful.

Any error that occurs after your program starts is a run-time error, not a compile-time error.
You haven't described what you mean by "hard exit".
There is nothing in such a simple mocked up code snippet that tells us anything remotely useful.

If I close the debug version of my .exe by literally closing(x) the window. My compiler says there was an access violation. This only happens if there are destructors that would have been called had the program ended on its own terms.