Cygwin Setup on Windows 11 (with Clang, Make, and Git)


Use Cygwin to compile C++ with clang, build with make, and manage code with git. Follow these steps to get started.


🔽 1. Download and Install Cygwin

  1. Download the Installer
    Visit the Cygwin website
    → Click setup-x86_64.exe to download the 64-bit installer.
  2. Run the Installer
    • Double-click setup-x86_64.exe.
    • Choose default options unless you have specific preferences.
    • Key options:
      • Installation type: Install from Internet
      • Root directory: C:\cygwin64 (default)
      • Local Package Directory: e.g., C:\cygwin\packages
      • Download site: Choose a mirror close to your location
  3. Select Packages
    On the “Select Packages” screen:
    • Expand the Devel category:
      • clang
      • make
    • Expand the Utils category:
      • git
  4. Finish Installation
    • Click Next to confirm selections.
    • The installer will download and install all selected packages.
    • Click Finish when done.

⚙️ 2. Configure Your Environment

  1. Launch Cygwin
    • Open Cygwin Terminal from the Start Menu or desktop shortcut.
  2. Verify Tools
    Run the following commands to confirm installation: clang --version make --version git --version
  3. (Optional) Add Cygwin to PATH
    If commands don’t work from regular CMD/PowerShell, add Cygwin to your system PATH:
    • Open: Start → SystemAdvanced system settings
    • Click: Environment Variables
    • Under System variables, edit the Path
    • Add: C:\cygwin64\bin
    • Click OK to save

🛠️ 3. Test Compilation and Git Setup

🔸 Create a Test C++ Program

nano hello.cpp

Paste in:

#include <iostream>
int main() {
    std::cout << "Hello, Cygwin!" << std::endl;
    return 0;
}

Press Ctrl+X, then Y, then Enter to save.

🔸 Compile and Run

clang++ hello.cpp -o hello
./hello

You should see:

Hello, Cygwin!

🔸 Optional: Create a Makefile

nano Makefile

Paste:

all: hello

hello: hello.cpp
	clang++ hello.cpp -o hello

clean:
	rm -f hello

Then run:

make       # Builds the program
make clean # Cleans up

🔸 Set Up Git Repository

git init
git add hello.cpp Makefile
git commit -m "Initial commit"

✅ Summary

You’ve now:

  • ✅ Installed Cygwin with clang, make, and git
  • ✅ Compiled a C++ program
  • ✅ Set up a Makefile build system
  • ✅ Initialized a Git repository

You’re ready to develop and manage C++ projects in a Unix-like environment on Windows.

Let me know if you want a printable PDF version or classroom handout!

Scroll to Top