Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 789
DivijM Avatar asked Feb 19 '26 22:02

DivijM


2 Answers

CTRL-F5 is just F5

It's probably worth noting since this is tagged c++ that CTRL-F5, run without debugging actually runs with debugging as of August 23rd 2021. That's in-spec for the app according to these 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'."

SHIFT-F5 is no Panacea

SHIFT-F5 from the standard C++ extension, by contrast, does run without debugging, but runs a target set by its own mechanism, not the current launch configuration used by F5 and CTRL-F5. Since it bypasses the launch.json launch configurations, it does not let you change the location of the current working directory for your app or pass-in command line arguments to it.

like image 57
ahcox Avatar answered Feb 22 '26 10:02

ahcox


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.

like image 31
AnsonH Avatar answered Feb 22 '26 12:02

AnsonH



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!