Install and use NBCpp
Start debugging a single C or C++ file on Windows x64.
Installation
In the VS Code Extensions view, search for NBCpp and install the extension published by Nebulazeyv. On Windows x64, you can use its bundled compiler and debugger, including on a fresh installation without MinGW, Visual Studio or the Microsoft C/C++ extension.
Your first debug session
Open a project folder
Choose File → Open Folder, then create and save
main.cppin that folder. Copy the example below into the file.Set a breakpoint and start
Click the gutter beside the
std::coutline. When the red dot appears, press F5. NBCpp configures a new workspace on first use. If the workspace already has a different launch configuration, use Smart Run in the upper-right corner of the editor to debug the current file.Enter a number and continue
Type
21in the integrated terminal and press Enter. When the debugger stops at the output statement, press F5 again. The terminal prints42.
#include <iostream>
int main() {
int n = 0;
std::cin >> n;
std::cout << n * 2 << '\n';
}Keyboard shortcuts
| Shortcut | Action |
|---|---|
| F5 | Start debugging or continue from a breakpoint. This is the default VS Code debug shortcut. |
| F10 | Step over the current statement while paused. |
| Ctrl + Alt + C | Build and debug C with NBCpp while the editor has focus. |
| Ctrl + Alt + D | Build and debug C++ with NBCpp while the editor has focus. |
Troubleshooting
The program seems to be waiting. Where do I type?
Programs that call scanf or std::cin wait for input. Open the Terminal panel, select the terminal running your program, type a value and press Enter. If execution is paused at a breakpoint, press F5 to continue first.
Can I debug the current file if my workspace already has a launch.json?
Open the source file and choose Smart Run in the upper-right corner of the editor. NBCpp selects a toolchain for that build and preserves your edited workspace configuration.
When reporting a problem, include your operating system, VS Code and NBCpp versions, and a small C or C++ program that reproduces it.
View or open an issue ↗