Problem with lazy foo tutorial 3

In tutorial 3of lazy foo(event-driven programming) the window closes as soon as it pops up even though the user is supposed to close it. What might be the problem?
http://lazyfoo.net/tutorials/SDL/03_event_driven_programming/index.php
problem i am facing: https://youtu.be/wmtY_D8x8Mc

What I would do is add some log statements. This can be as simple as a printf, if you’re using C. Log the start of execution, the type of any events you’re handling (if you’re following the tutorial exactly, just put something before the “quit = true” line that logs “user exited” or something), and the end of execution.

This way you can narrow down why it’s closing–whether the quit event is firing and it’s closing normally, or whether something else is happening. Then of course, once you figure out what’s going on, you take them out.

Remember that the lazyfoo tutorial is for an earlier version of SDL, so it’s possible that it might need some tweaks to run properly.

I just realized you’re just running the lazyfoo tutorial directly. Try running the compiled file directly; vscode is trying to run it in debug mode with gdb and so your environment may be the issue (you may not have gdb installed, or it may not be receiving debug symbols correctly)