Megatron
Megatron

Reputation: 2949

How to find line/method that caused a debug assertion error in Visual C++

I'm working on a program that sometimes throws debug assertion errors on vectors, more speifically the errors is:

Expression: vector iterator not dereferencable

The problem is that I don't know the line or method where this error is occuring. I'd prefer not to manually step/break through my program until the error occurs. I'm looking for away to find the line number or at least the method that is causing this error.

I'm using VS2010

thanks in advance

Upvotes: 4

Views: 1774

Answers (1)

Kiril Kirov
Kiril Kirov

Reputation: 38173

When it crashes, hit "retry" and then "break". Then take a look at the stack trace and go "down" till you got to a point in you code. This will show you which is the last place in you code, that is called before the crash.

Upvotes: 7

Related Questions