Set up an editor, a C compiler and a terminal. The compiler translates your C source into an executable for your operating system.
What you need
- GCC or another C compiler
- A text editor
- A terminal
Set up your environment
- Install VS Code if desired, then install a compiler separately. The C/C++ editor extension does not supply a compiler.
- On Windows follow the official VS Code MinGW/MSYS2 guide. Install the UCRT64 toolchain and add its bin folder to PATH as documented. On Linux use your distribution compiler packages; on macOS install the command-line developer tools.
- Reopen the terminal and verify
gcc --version. Create a practice folder and save the file there. - Compile from the folder containing the source file, then run the executable. The commands below show a Windows terminal. On Linux/macOS choose an output name without .exe and run it with ./hello.
Your first check
Save as hello.c
#include <stdio.h>
int main(void) {
printf("Hello from w1coding.com\n");
return 0;
}Run or verify
gcc hello.c -o hello.exe
.\hello.exeExpected result: The terminal prints Hello from w1coding.com.
Common setup problems
- If gcc is not recognised, check the compiler installation and PATH, then open a new terminal.
- Save C files with the .c extension. Compilation errors must be fixed before running the program.
Official documentation
Guide reviewed 17 November 2026. Check the linked vendor documentation for current supported versions and operating systems.