Docs

README

IDEs and Compilers for C Programming

šŸ“– Introduction

To write and run C programs, you need two essential tools:

  1. •Text Editor or IDE - Where you write your code
  2. •Compiler - Converts your code into executable programs

This guide covers popular options for both, helping you set up your development environment.


šŸ”§ C Compilers

A compiler translates C source code into machine code that your computer can execute.

Popular C Compilers

1. GCC (GNU Compiler Collection)

The most widely used open-source compiler.

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│                      GCC                            │
ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│ Platform    : Linux, macOS, Windows (MinGW)        │
│ License     : GPL (Free, Open Source)              │
│ Standards   : C89, C99, C11, C17, C23              │
│ Best for    : Linux development, learning          │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

Installation:

# Ubuntu/Debian
sudo apt update
sudo apt install build-essential

# Fedora
sudo dnf install gcc

# macOS
xcode-select --install

# Windows (MinGW-w64)
# Download from: https://www.mingw-w64.org/

Basic Usage:

# Compile a single file
gcc hello.c -o hello

# Compile with warnings
gcc -Wall -Wextra hello.c -o hello

# Compile with debugging info
gcc -g hello.c -o hello

# Compile with optimization
gcc -O2 hello.c -o hello

# Use specific C standard
gcc -std=c99 hello.c -o hello
gcc -std=c11 hello.c -o hello
gcc -std=c17 hello.c -o hello

2. Clang (LLVM)

Modern compiler with excellent error messages.

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│                     Clang                           │
ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│ Platform    : Linux, macOS, Windows                │
│ License     : Apache 2.0 (Free, Open Source)       │
│ Standards   : C89, C99, C11, C17, C23              │
│ Best for    : macOS dev, better error messages     │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

Installation:

# Ubuntu/Debian
sudo apt install clang

# Fedora
sudo dnf install clang

# macOS (included with Xcode)
xcode-select --install

# Windows
# Download from: https://releases.llvm.org/

Basic Usage:

# Compile
clang hello.c -o hello

# With warnings
clang -Wall -Wextra hello.c -o hello

3. Microsoft Visual C++ (MSVC)

Microsoft's compiler for Windows development.

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│                      MSVC                           │
ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│ Platform    : Windows only                         │
│ License     : Proprietary (Community version free) │
│ Standards   : C89, C99, C11, C17 (partial)        │
│ Best for    : Windows application development      │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

Installation:

Usage:

# From Developer Command Prompt
cl hello.c

Compiler Comparison Table

FeatureGCCClangMSVC
Linux Supportāœ… Nativeāœ… NativeāŒ No
macOS Supportāœ… Yesāœ… NativeāŒ No
Windows Supportāœ… MinGWāœ… Yesāœ… Native
Error MessagesGoodExcellentGood
C17 Supportāœ… Fullāœ… Fullāœ… Partial
Open Sourceāœ… Yesāœ… YesāŒ No
PriceFreeFreeFree (Community)

šŸ’» Integrated Development Environments (IDEs)

IDEs provide a complete environment with editor, compiler, debugger, and other tools.

1. Visual Studio Code (VS Code)

The most popular free code editor, highly customizable.

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│               Visual Studio Code                    │
ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│ Platform    : Windows, macOS, Linux                │
│ Price       : Free, Open Source                    │
│ Type        : Code Editor (becomes IDE with ext.)  │
│ Best for    : All skill levels                     │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

Setup for C:

  1. •

    Install VS Code: https://code.visualstudio.com/

  2. •

    Install C/C++ Extension:

    • •Open VS Code
    • •Go to Extensions (Ctrl+Shift+X)
    • •Search for "C/C++" by Microsoft
    • •Click Install
  3. •

    Install a Compiler (GCC or Clang)

  4. •

    Create tasks.json for building:

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Build C Program",
      "type": "shell",
      "command": "gcc",
      "args": [
        "-g",
        "-Wall",
        "${file}",
        "-o",
        "${fileDirname}/${fileBasenameNoExtension}"
      ],
      "group": {
        "kind": "build",
        "isDefault": true
      }
    }
  ]
}
  1. •Create launch.json for debugging:
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Debug C Program",
      "type": "cppdbg",
      "request": "launch",
      "program": "${fileDirname}/${fileBasenameNoExtension}",
      "args": [],
      "stopAtEntry": false,
      "cwd": "${workspaceFolder}",
      "environment": [],
      "externalConsole": false,
      "MIMode": "gdb",
      "preLaunchTask": "Build C Program"
    }
  ]
}

Recommended Extensions:

  • •C/C++ (Microsoft)
  • •Code Runner
  • •C/C++ Compile Run
  • •Error Lens

2. Code::Blocks

A free IDE specifically designed for C/C++.

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│                   Code::Blocks                      │
ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│ Platform    : Windows, macOS, Linux                │
│ Price       : Free, Open Source                    │
│ Type        : Full IDE                             │
│ Best for    : Beginners                            │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

Setup:

  1. •Download from: http://www.codeblocks.org/downloads
  2. •Choose the version with MinGW (includes compiler)
  3. •Install and run

Features:

  • •Built-in compiler support
  • •Project management
  • •Debugger integration
  • •Code completion

3. CLion (JetBrains)

Professional IDE with advanced features.

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│                     CLion                           │
ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│ Platform    : Windows, macOS, Linux                │
│ Price       : Paid (Free for students)             │
│ Type        : Professional IDE                      │
│ Best for    : Professional development             │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

Features:

  • •Intelligent code completion
  • •Advanced refactoring
  • •Built-in debugger
  • •CMake support
  • •Version control integration

4. Dev-C++ (Embarcadero)

Lightweight IDE for Windows.

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│                    Dev-C++                          │
ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│ Platform    : Windows only                         │
│ Price       : Free                                 │
│ Type        : Lightweight IDE                      │
│ Best for    : Quick projects, learning             │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

5. Eclipse CDT

Eclipse with C/C++ Development Tools.

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│                  Eclipse CDT                        │
ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│ Platform    : Windows, macOS, Linux                │
│ Price       : Free, Open Source                    │
│ Type        : Full IDE                             │
│ Best for    : Large projects                       │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

IDE Comparison

FeatureVS CodeCode::BlocksCLionDev-C++
PriceFreeFreePaidFree
Built-in CompilerNoYesNoYes
DebuggingGoodGoodExcellentBasic
Code CompletionGoodBasicExcellentBasic
Learning CurveLowLowMediumLow
Cross-platformYesYesYesWindows
Memory UsageMediumLowHighLow

šŸ› ļø Setting Up Your Environment

Option 1: VS Code + GCC (Recommended)

This is the most versatile setup that works on all platforms.

Linux Setup:

# 1. Install GCC
sudo apt update
sudo apt install build-essential gdb

# 2. Verify installation
gcc --version
gdb --version

# 3. Install VS Code
# Download from: https://code.visualstudio.com/

# 4. Install C/C++ extension in VS Code

Windows Setup:

1. Install MinGW-w64:
   - Download from: https://www.msys2.org/
   - Run installer
   - Open MSYS2 terminal
   - Run: pacman -S mingw-w64-x86_64-gcc

2. Add to PATH:
   - Add C:\msys64\mingw64\bin to system PATH

3. Install VS Code:
   - Download from: https://code.visualstudio.com/

4. Install C/C++ extension in VS Code

macOS Setup:

# 1. Install Xcode Command Line Tools
xcode-select --install

# 2. Verify installation
gcc --version
# (Actually Clang on macOS)

# 3. Install VS Code
# Download from: https://code.visualstudio.com/

# 4. Install C/C++ extension in VS Code

Option 2: Online Compilers

For quick testing without local setup:

WebsiteURLFeatures
OnlineGDBhttps://www.onlinegdb.com/online_c_compilerDebugging support
Replithttps://replit.com/languages/cCollaborative
Programizhttps://www.programiz.com/c-programming/online-compilerSimple UI
JDoodlehttps://www.jdoodle.com/c-online-compilerMultiple inputs
Compiler Explorerhttps://godbolt.org/See assembly output

šŸ“‹ GCC Command Reference

Common Options

# Basic compilation
gcc source.c                    # Output: a.out
gcc source.c -o program         # Output: program

# Warning flags
gcc -Wall source.c              # Enable common warnings
gcc -Wextra source.c            # Enable extra warnings
gcc -Werror source.c            # Treat warnings as errors
gcc -pedantic source.c          # Strict ISO C compliance

# Optimization
gcc -O0 source.c                # No optimization (default)
gcc -O1 source.c                # Basic optimization
gcc -O2 source.c                # Standard optimization
gcc -O3 source.c                # Maximum optimization
gcc -Os source.c                # Optimize for size

# Debugging
gcc -g source.c                 # Add debug info
gcc -ggdb source.c              # GDB-specific debug info

# C standard selection
gcc -std=c89 source.c           # ANSI C
gcc -std=c99 source.c           # C99 standard
gcc -std=c11 source.c           # C11 standard
gcc -std=c17 source.c           # C17 standard

# Include and library paths
gcc -I/path/to/headers source.c # Add include directory
gcc -L/path/to/libs source.c    # Add library directory
gcc source.c -lm                # Link math library
gcc source.c -lpthread          # Link pthread library

# Multiple files
gcc file1.c file2.c -o program  # Compile multiple files
gcc -c file1.c                  # Compile to object file
gcc file1.o file2.o -o program  # Link object files

Recommended Compilation Command

For development and learning:

gcc -Wall -Wextra -g -std=c11 source.c -o program

For production:

gcc -Wall -Wextra -O2 -std=c11 source.c -o program

šŸ” Debugging with GDB

GDB (GNU Debugger) is the standard debugger for C programs.

Basic GDB Commands

# Start debugging
gdb ./program

# Inside GDB:
run                 # Run the program
break main          # Set breakpoint at main
break 10            # Set breakpoint at line 10
next                # Execute next line
step                # Step into function
continue            # Continue execution
print variable      # Print variable value
backtrace           # Show call stack
quit                # Exit GDB

Debugging Workflow

# 1. Compile with debug info
gcc -g program.c -o program

# 2. Start GDB
gdb ./program

# 3. Set breakpoints
(gdb) break main
(gdb) break 15

# 4. Run
(gdb) run

# 5. Inspect variables
(gdb) print x
(gdb) print *ptr

# 6. Continue
(gdb) next
(gdb) continue

šŸ”‘ Key Takeaways

  1. •GCC is the most common compiler - works on all platforms
  2. •VS Code is highly recommended - free, extensible, cross-platform
  3. •Code::Blocks is good for beginners - includes compiler
  4. •Always compile with warnings - use -Wall -Wextra
  5. •Use -g for debugging - enables GDB debugging
  6. •Online compilers are convenient - for quick tests

ā­ļø Next Module

Continue to Module 2: Basic Syntax to start writing C code!

README - C Programming Tutorial | DeepML