.cpp

How to open a .cpp file

Quick, free ways to open C++ on any system.

A .cpp file is a C++ Source File. If double-clicking does nothing, your computer simply does not have an app that reads C++ yet. Here is how to fix that on each operating system, using free software wherever possible.

Open a .cpp file step by step

  1. Confirm the file really is a .cpp. Drop it into the WhatFileType file identifier, which reads its signature without uploading anything.
  2. On Windows, open it with Visual Studio or VS Code.
  3. On Mac, use Xcode or VS Code.
  4. On Linux, try VS Code or vim.
  5. Still stuck? Convert the .cpp to exe (via a compiler), which opens more widely.

Best apps to open .cpp files

Windows

  • Visual Studio
  • VS Code
  • any text editor

macOS

  • Xcode
  • VS Code
  • any text editor

Linux

  • VS Code
  • vim
  • g++ / clang++
!
Before you open it: Caution. A .cpp file is program source. Compiling and running it executes its code; review untrusted files first.

Frequently asked questions

Why can't I open my .cpp file?

Almost always because no installed app understands C++. Install one of the apps above, or convert the file to a format your existing software already reads.

How do I compile a .cpp file?

Use a C++ compiler: g++ file.cpp -o program then run it, or build it in Visual Studio, Xcode or VS Code.

What is the difference between C and C++?

C++ builds on C, adding classes, templates and a rich standard library while keeping C's speed. Most C code also compiles as C++.

Learn more about .cpp