After this lesson, you will be able to: Set up a C dev environment: GCC, clang, VS Code with the C/C++ extension.
C dev environments vary by OS. Get the basics working once.
GCC: GNU C compiler. Default on most Linux. clang: LLVM-based; default on macOS. Slightly nicer error messages. MSVC: Microsoft Visual C++. Windows-native; usually via Visual Studio. For learning: GCC or clang. They're interchangeable for most code.
Per OS.
# macOSxcode-select --install # provides clang + makeclang --version# Linux (Ubuntu/Debian)sudo apt install build-essential gdb valgrindgcc --version# Windows: either WSL (recommended) or install MinGW-w64 / MSYS2# WSL: enable Windows Subsystem for Linux + install Ubuntu → use Linux steps# Compile + rungcc hello.c -o hello -Wall -Wextra -std=c17 -g./hello# Flags:# -Wall -Wextra enable warnings (always use)# -std=c17 use the C17 standard# -g include debug symbols (for gdb / lldb)# -O2 optimize (use for release builds)
Best free C IDE for most people.
# Install VS Code# Install extensions:# - C/C++ (Microsoft)# - CodeLLDB (debugger), for clang# - clangd (better intellisense than ms-vscode.cpptools)# .vscode/tasks.json, one-key compile# .vscode/launch.json, one-key debug
Compiling without -Wall -Wextra. Hidden bugs ship. Skipping -g during dev. Can't use gdb effectively. Hardcoding paths instead of using Makefiles or CMake. Mixing standards (-std=c89 vs c17). Pick one per project.
Pick the senior answer.
Sign in and purchase access to unlock this lesson.