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:
- A text editor or IDE (like VS Code or Code::Blocks)
- A C compiler (like GCC or Clang)
Windows Setup
Option 1: Code::Blocks (Recommended for Beginners)
-
Go to www.codeblocks.org
-
Download “codeblocks-XXmingw-setup.exe”
Includes the GCC compiler.
-
Install and launch Code::Blocks.
-
Start a new C project and run your first program.
Option 2: GCC via MinGW
-
Download MinGW from: https://osdn.net/projects/mingw/
-
Install the base system and C compiler.
-
Add the
bin
folder (e.g.,C:\MinGW\bin
) to your System PATH. -
Use any text editor (e.g., Notepad++, VS Code) and compile using Command Prompt:
gcc hello.c -o hello.exe hello.exe
macOS Setup
-
Open Terminal.
-
Install Xcode Command Line Tools:
xcode-select --install
-
Use a text editor like VS Code, or the Xcode IDE.
-
Compile and run in Terminal:
gcc hello.c -o hello ./hello
Linux (Ubuntu/Debian) Setup
-
Open Terminal.
-
Install GCC:
sudo apt update sudo apt install build-essential
-
Write code in any editor (e.g., Gedit, VS Code, Nano).
-
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.