Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>C/C++ Compile RunNew to Visual Studio Code? Get it now.
C/C++ Compile Run

C/C++ Compile Run

danielpinto8zz6

|
4,879,533 installs
| (59) | Free
Easily compile, run, and debug single C/C++ files in VS Code.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Logo

C/C++ Compile Run Extension

Buy Me A Coffee Support via PayPal

Visual Studio Marketplace Version Visual Studio Marketplace Downloads Visual Studio Marketplace Rating Open VSX Version Open VSX Downloads Open VSX Rating

A Visual Studio Code extension to compile, run, and debug single C/C++ files easily.

Extension Screenshot

Features

  • Compile, run, and debug C/C++ files directly from the command palette, status bar, or menu icons.
  • Quick access via keybindings: F6, F7, F5, and more.
  • Supports custom compiler paths, flags, and run arguments.
  • Option to run in an external terminal.

Requirements

  • Linux: Install gcc (setup instructions)
  • Windows: Install tdm-gcc (setup instructions)
  • macOS: Install clang or gcc (setup instructions)

Getting Started

  1. Open a .c or .cpp file in VS Code.
  2. Press F6 to compile and run the file with default settings.
  3. Press F7 to specify custom arguments before running.
  4. Press F5 to debug (includes compilation).
  5. Use the status bar or menu icons for quick access.

Tip: You can configure compiler paths, flags, and other options in the extension settings. Enable "Save Before Compile" to automatically save files before building.

Configuration

Key Description
c-cpp-compile-run.c-compiler The C compiler path (e.g. /usr/bin/gcc or C:\TDM-GCC-64\bin\gcc.exe)
c-cpp-compile-run.cpp-compiler The C++ compiler path (e.g. /usr/bin/g++ or C:\TDM-GCC-64\bin\g++.exe)
c-cpp-compile-run.save-before-compile Save the file before compiling
c-cpp-compile-run.c-flags C compiler flags (default: -Wall -Wextra -g3)
c-cpp-compile-run.c-linker-flags C linker flags (e.g. -lm)
c-cpp-compile-run.cpp-flags C++ compiler flags (default: -Wall -Wextra -g3)
c-cpp-compile-run.cpp-linker-flags C++ linker flags (e.g. -lm)
c-cpp-compile-run.run-args Program arguments when running
c-cpp-compile-run.run-in-external-terminal Run in an external terminal
c-cpp-compile-run.should-show-notifications Show notifications
c-cpp-compile-run.output-location Custom output location for the compiled file
c-cpp-compile-run.custom-run-prefix Prefix command before run (e.g. valgrind ./foobar)

Keybindings

Linux Windows Mac Description
F6 F6 Cmd+R Compile and run the file
Ctrl+6 Ctrl+6 Cmd+6 Compile and run the file
F8 F8 Cmd+Y Compile and run the file in an external console
F7 F7 Cmd+T Compile and run the file with custom arguments and flags
F5 F5 Cmd+5 Debug the file (includes compile)

Release Notes

See the CHANGELOG for details.

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