ACCESS_VIOLATION debugging with GCC

Good day!

I am new to C++, currently I am using GCC 10.2.0-1 from MSYS2 on Windows.
I am compiling & running my little programs from console.
Sometimes happens that I see something like that:
[Finished in 0.5s with exit code 3221225477]
Google told me that this is the code for STATUS_ACCESS_VIOLATION.

How can I determine which line of code caused this?
Does your msys come with gdb?

In a normal Unix environment, you would do
1
2
g++ -g prog.cpp
gdb ./a.out
Run it through a debugger (gdb).

Compile it with the option -g (for debugging), then run it as
gdb progname
(enter 'run' if necessary).

It would also be useful to add compile options such as -Wall -Wextra -pedantic
You could post your code here.
Sometimes it takes only one look to see what the problem is.
Thanks! GDB did the job. It is not in default MSYS2 installation, but it can be downloaded with MSYS2 package manager.

lastchance, thanks for "run" command advise, it was not that obvious =)

thmm, of course, I did exactly that "look" a bunch of times, but now decided to learn how to do it with debugger.
Registered users can post here. Sign in or register to post.