SkillAgentSearch skills...

CPPDevOnWindows

Best guide to setup C/C++ development environment on Windows

Install / Use

/learn @HO-COOH/CPPDevOnWindows
About this skill

Quality Score

0/100

Supported Platforms

GitHub Copilot

README

The definitive guide of setting up C/C++ development environment on Windows

I know a lot of you are having troubles of getting it to work on Windows and complaining a shiton. I will admit, that most C++ programming books do NOT actually tell you how to set things up. And I think that's hilarious, because how are you supposed to program without a working development environment? Although some books do mention it, they usually target Unix operating systems.

You can just use Visual Studio, which is the best and beginner-friendly solution and has really good documentation from Microsoft, but for some reason you are just a boomer and don't want to use it and you are dumb to set up the alternatives.

Now, you have found the right guide! This guide aims to provide the fullest list of every possible main-stream IDEs/text editors you might want to use and its respective configuration on Windows.

Follow the guide and screenshot carefully. The screenshot are from Windows Sandbox, which is a clean install of Windows 10. If you followed everything, and can't get it work, open an issue. Let me see how that's even possible!!

A visual summary of this guide:

flowchart TD
    A[Start]
    A-->Compiler{Compiler}
    A-->VisualStudio
    Compiler-->MSYS2{MSYS2}
    MSYS2--->GCC
    MSYS2--->Clang
    Compiler-->MSVC

    GCC-->CMake
    Clang-->CMake
    MSVC-->CMake

    CMake-->IDE{IDE}
    IDE-->VisualStudio
    IDE-->QtCreator
    IDE-->CLion

    CMake-->Editor{Text Editor}
    Editor-->Vim
    Editor-->VSCode[Visual Studio Code]
    
    GTest[Google test & Doxygen]-. integrate .->VisualStudio
    GTest[Google test & Doxygen]-. integrate .->VSCode
    GTest[Google test & Doxygen]-. integrate .->CLion
    GTest[Google test & Doxygen]-. integrate .->CMake

    subgraph tooling
    Additional[Additional tooling]---ReSharper
    Additional---ClangTidy
    Additional---ClangFormat
    Additional---Incredibuild
    end

Setting up development environment

This section describes the steps to

  1. Download & Install a C++ compiler
  2. Download & Install CMake
  3. Download & Install an IDE/text editor
  4. Create a project in various IDEs/text editors and start writing code

Download & Install a C++ compiler

This guide will cover the installation of GCC, Clang and MSVC.

GCC & Clang

Download & Install MSYS2

Download here

Just launch the installer and keep clicking "Next"

Install GCC

If you also want to install clang, skip this part and go directly to Install Clang, because GCC is a dependency of Clang (on MSYS2) and will be automatically installed when you install clang.

  1. Run MSYS2, type the following command:
pacman -Syu

pacman is the package manager used by MSYS2. -S means "sync". -y means "download fresh package databases from the server". -u means "upgrade installed packages".

This command will update the packages info, so you get the latest packages. It will prompt you like this, and you type y and hit enter.

  1. Then it will prompt you To complete this update all MSYS2 processes including this terminal will be closed. Confirm to proceed [Y/n], type y and hit enter, and it will close the window after the update is done.
  2. Relaunch MSYS2 from your start menu. Type:
pacman -S mingw-w64-x86_64-gcc

like this, type y and hit enter to install gcc

And then type:

pacman -S mingw-w64-x86_64-make

And type y to also install make.

And then type:

pacman -S mingw-w64-x86_64-gdb

And type y to also install gdb.

  1. Now search for environment variable and open it

  2. Click Environment Variables, find Path in System variables, double click to open the setting.

  3. Click New and copy C:\msys64\mingw64\bin to the new entry.

  4. Click OK to close all windows. Now you finished installing GCC. Open any shell such as cmd and type in gcc --version and you shall see the following:

Install Clang

Installing Clang will also automatically install GCC (on MSYS2).

  1. Run MSYS2, type the following command:
pacman -Syu

pacman is the package manager used by MSYS2. -S means "sync". -y means "download fresh package databases from the server". -u means "upgrade installed packages".

This command will update the packages info, so you get the latest packages. It will prompt you like this, and you type y and hit enter.

  1. Then it will prompt you To complete this update all MSYS2 processes including this terminal will be closed. Confirm to proceed [Y/n], type y and hit enter, and it will close the window after the update is done.

  2. Relaunch MSYS2 from your start menu. Type:

pacman -S mingw-w64-x86_64-clang mingw-w64-x86_64-clang-tools-extra

like this, type y and hit enter to install clang

And then type:

pacman -S mingw-w64-x86_64-make

And type y to also install make.

And then type:

pacman -S mingw-w64-x86_64-gdb

And type y to also install gdb.

  1. Now search for environment variable and open it

  2. Click Environment Variables, find Path in System variables, double click to open the setting.

  3. Click New and copy C:\msys64\mingw64\bin to the new entry.

  4. Click OK to close all windows. Now you finished installing clang. Open any shell such as cmd and type in clang --version and you shall see the following:

(9. Optional): If you want to get clang's implementation of the C++ standard library (ie. the STL), type this command: pacman -S mingw-w64-x86_64-libc++ When invoking clang++, add the flag -stdlib=libc++. The header files of libc++ will be stored at C:\msys64\mingw64\include\c++\v1.

Note: Clang and GCC is installed to the same directory, eg. under C:\msys64\mingw64\bin. Don't be confused by the directory C:\msys64\clang64. It is an empty folder.

What is MSYS2 and Why?

MSYS2 is a collection of to

View on GitHub
GitHub Stars248
CategoryDevelopment
Updated24d ago
Forks17

Security Score

85/100

Audited on Mar 7, 2026

No findings