cppnb — C++ Notebook

VS Code Extension · Published by 06Neel

Live on Marketplace VS Code Extension 219 Installs MIT License
219 Installs
C++17 Default Std
5s Cell Timeout
MIT License

About

cppnb brings the Jupyter notebook experience to C and C++ development inside Visual Studio Code. Instead of compiling and running full programs every time, you write code in individual cells — execute them independently, persist state across them, and see inline output instantly.

Ideal for learning C++, experimenting with algorithms, doing competitive programming dry runs, or prototyping data structures — without leaving your editor.

C++ C VS Code API GCC Clang MinGW WSL TypeScript

Key Features

Notebook-style cell execution — run individual cells in isolation
State caching — functions, classes, variables persist across cells
Auto input detection for cin, getline, scanf
Pretty formatted output cards with cppnb.prettyUI
Configurable compiler — supports MinGW, GCC, Clang, WSL
Timeout protection — prevents infinite loops from hanging VS Code

Getting Started

1

Install MinGW-w64 and make sure g++ is in your system PATH. Verify with where g++ in terminal.

2

Search cppnb in VS Code Extensions panel or install directly from the Marketplace link above.

3

Press Ctrl + Shift + P and run C++ Notebook: New Notebook. Save with the .cppnb extension.

4

Write State Cells (no main()) to define functions and variables, then Run Cells (with main()) to execute and see output.

Example

A State Cell defines a reusable function. A Run Cell calls it with main():

// ── State Cell ────────────────────────────── int add(int a, int b) { return a + b; } // ── Run Cell ───────────────────────────────── #include <iostream> using namespace std; int main() { cout << add(5, 7) << endl; // Output: 12 }

Settings

Setting Default Description
cppnb.compilerPath C:\MinGW\bin\g++.exe Path to your g++ compiler
cppnb.std c++17 C++ standard used for compilation
cppnb.timeoutMs 5000 Execution timeout per cell (ms)
cppnb.extraArgs [] Extra arguments passed to g++
cppnb.askForInput auto When to prompt for input: auto / always / never
cppnb.prettyUI true Show formatted output blocks

All Tools