Search code examples
c++visual-studio-code

Difference between Run Code and Run without Debugging in VS Code


I am a newbie in cpp programming and use visual studio code, I don't understand what is the difference between Ctrl + Alt + N(To run code) and Ctrl + F5(Run without Debugging).

enter image description here

enter image description here


Solution

  • Ctrl+Alt+N (Run Code) is a shortcut provided by the "Code Runner" extension you've installed. It runs the code without debugging.

    Ctrl+F5 (Debug: Start without Debugging) is a VS Code default shortcut. Despite its name, it actually runs the C++ code with debugging. This is because according to the VS Code docs:

    Tip: The Run action is always available, but not all debugger extensions support 'Run'. In this case, 'Run' will be the same as 'Debug'.

    Apparently the C/C++ extension does not support "Run", so Ctrl + F5 will launch a debug session instead.