1. Installation
GCC is typically installed as part of the GNU Core Utilities.
To install GCC on Ubuntu-based systems:
sudo apt update sudo apt install -y gcc
For other OS versions, refer to your distribution's documentation.
2. Configuration
Configure GCC with optional options. For example:
gcc --help
This shows available options. You can specify options when compiling.
3. Compiling
Compile a C program with GCC:
gcc -o hello hello.c ./hello
The output will be the compiled executable.
4. Debugging
Use GDB to debug a program:
gdb ./hello (gdb) run
Enter commands to debug the program.
5. Cleaning
Remove old build files:
make clean
This ensures you don't have duplicate files from previous builds.