How to Install C++ on Windows 10

There’s no single “C++ download” for Windows 10. You install a compiler and, usually, an editor. The easiest option is Visual Studio Community (free) with the Desktop development with C++ workload, which includes Microsoft’s C++ compiler, the libraries, and a debugger. If you prefer a lighter setup, install Visual Studio Code plus the free GCC compiler from MSYS2.

Both options are free for students, individuals, and open-source work. Visual Studio Community has license limits for larger companies.

Note: Windows 10 reached end of support on October 14, 2025. Consumer Extended Security Updates (ESU) now run until October 12, 2027. These steps also work on Windows 11.

Quick Answer

Download Visual Studio Community, run the installer, check Desktop development with C++, select Install, then create a new Console App project and press Ctrl + F5 to run it.

Option 1: Install Visual Studio Community

  1. Go to Microsoft’s Visual Studio download page and download Community. The current version is Visual Studio 2026.
  2. Run the installer and allow it to update itself.
  3. On the Workloads tab, check Desktop development with C++.
  4. Select Install. The download is several gigabytes.
  5. When it finishes, open Visual Studio and sign in or skip.
Installer Workloads tab with Desktop development with C++ checked and highlighted
The Desktop development with C++ workload installs the compiler, libraries, and debugger you need.

Microsoft’s guide to installing C and C++ support in Visual Studio lists the optional components.

Run your first program

  1. Select Create a new project, choose Console App (C++), and select Next.
  2. Name the project and select Create. A “Hello World” program is already written.
  3. Press Ctrl + F5 to build and run it. A console window shows the output.

Option 2: Visual Studio Code With GCC (MSYS2)

  1. Download and install MSYS2 from its official website.
  2. Open the MSYS2 UCRT64 terminal and run pacman -S --needed mingw-w64-ucrt-x86_64-toolchain. Press Enter to accept the defaults.
  3. Add C:\msys64\ucrt64\bin to your Path: search for Edit the system environment variables, select Environment Variables, edit Path, and add the folder.
  4. Open a new Command Prompt and run g++ --version to confirm it works.
  5. Install Visual Studio Code and the C/C++ extension from Microsoft.
  6. Create a file named hello.cpp, then compile it with g++ hello.cpp -o hello.exe and run hello.

Our guides to installing GCC on Windows and compiling C in Windows go into more detail.

Which Option Should You Choose?

Visual Studio Community VS Code + GCC
Setup One installer Several steps
Download size Several GB Smaller
Debugger Built in, very capable Needs configuration
Best for Beginners, Windows apps, games Cross-platform code, courses that use GCC

You can also compile C++ with Linux tools through WSL. Here’s how to install Linux on Windows.

Troubleshooting

  • “g++ is not recognized”: The Path wasn’t updated, or you opened the command window before changing it. Open a new window.
  • “cannot open source file iostream” in Visual Studio: The C++ workload isn’t installed. Open Visual Studio Installer, select Modify, and check it.
  • The console window closes instantly: Run with Ctrl + F5 instead of F5, or run the program from a Command Prompt.

Frequently Asked Questions

Is C++ free on Windows?

Yes. The compilers and editors above are free for personal use.

Do I need the Microsoft Visual C++ Redistributable?

That package only runs programs built with Visual C++. It doesn’t let you write or compile code.

Summary

  1. Install Visual Studio Community with Desktop development with C++.
  2. Or install MSYS2’s GCC and Visual Studio Code.
  3. Build a Console App or compile with g++ to test your setup.