Skip to content
| Marketplace
Sign in
Visual Studio Code>Extension Packs>C++ Active File Project TemplateNew to Visual Studio Code? Get it now.
C++ Active File Project Template

C++ Active File Project Template

AlgoAscent

| (0) | Free
Creates a beginner-friendly C++ project that builds and debugs whichever .cpp file is active on macOS, Linux, or Windows.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

C++ Active File Project Template

Create a ready-to-debug, single-file C++ practice project from the VS Code Command Palette on macOS, Linux, or Windows.

What it creates

  • hello.cpp with comments explaining active-file execution
  • .vscode/tasks.json that compiles ${file}
  • .vscode/launch.json using CodeLLDB
  • .vscode/settings.json that opens the Debug Console and avoids unwanted assembly views
  • Immediate std::cout flushing so output remains visible before debugger stops
  • Compiler warnings on every supported platform
  • Undefined-behaviour sanitizer on macOS and Linux

Use

  1. Install the extension.
  2. Open an empty folder in VS Code.
  3. Open the Command Palette:
    • macOS: Shift+Command+P
    • Windows/Linux: Ctrl+Shift+P
  4. Run C++ Active File: Create Cross-Platform C++ Debug Project.
  5. Open a .cpp file and press F5.

The active editor file is compiled because the build task uses ${file}. Switching to a different .cpp file before pressing F5 builds and runs that file instead.

Platform behaviour

Platform Preferred compiler Output
macOS Apple Clang++ build/Debug/outDebug
Linux G++, then Clang++ build/Debug/outDebug
Windows MinGW G++, then LLVM Clang++ build\Debug\outDebug.exe

The extension detects an available compiler when possible and writes that command into the generated tasks.json.

Requirements

  • VS Code
  • CodeLLDB
  • Microsoft C/C++ extension
  • A C++ compiler available on PATH

CodeLLDB and Microsoft C/C++ are included in this extension's extension pack. Compilers must be installed separately.

Scope

This is a single-file learning template. The active .cpp file must contain main(). Multi-file applications should use a build system such as CMake.

Publishing

See PUBLISHING.md for Marketplace instructions.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft