Setting Up a C Development Environment

The tutorial will guide you through setting up a complete development environment on Windows, macOS, and Linux — including compilers, editors, and IDEs.

Requirements to install C

To write and run C programs, you need:

  1. A text editor or IDE (like VS Code or Code::Blocks)
  2. A C compiler (like GCC or Clang)

Windows Setup

Option 1: Code::Blocks (Recommended for Beginners)

  1. Go to www.codeblocks.org

  2. Download “codeblocks-XXmingw-setup.exe”

    Includes the GCC compiler.

  3. Install and launch Code::Blocks.

  4. Start a new C project and run your first program.

Option 2: GCC via MinGW

  1. Download MinGW from: https://osdn.net/projects/mingw/

  2. Install the base system and C compiler.

  3. Add the bin folder (e.g., C:\MinGW\bin) to your System PATH.

  4. Use any text editor (e.g., Notepad++, VS Code) and compile using Command Prompt:

    gcc hello.c -o hello.exe
    hello.exe
    

macOS Setup

  1. Open Terminal.

  2. Install Xcode Command Line Tools:

    xcode-select --install
    
  3. Use a text editor like VS Code, or the Xcode IDE.

  4. Compile and run in Terminal:

    gcc hello.c -o hello
    ./hello
    

Linux (Ubuntu/Debian) Setup

  1. Open Terminal.

  2. Install GCC:

    sudo apt update
    sudo apt install build-essential
    
  3. Write code in any editor (e.g., Gedit, VS Code, Nano).

  4. Compile and run:

    gcc hello.c -o hello
    ./hello
    

Recommended IDEs and Editors

IDE/Editor Best For Platforms
Code::Blocks Beginners Windows/Linux/macOS
Visual Studio Windows development Windows
VS Code + GCC Customizable All
CLion (JetBrains) Professional use All
Xcode macOS only macOS

Tips

  • Use VS Code if you want a modern, flexible editor with extensions.
  • For school projects, Code::Blocks is often the easiest to start with.
  • Always test with a simple program after setup to ensure everything works.