Prerequisites
Before building Fract’ol, ensure you have the following dependencies installed on your system:GCC Compiler
GNU Compiler Collection for compiling C code
Make
Build automation tool for running the Makefile
MiniLibX
Graphics library for creating windows and handling events
X11 Libraries
X Window System libraries (libX11, libXext)
Installing Dependencies
- Ubuntu/Debian
- Fedora/RHEL
- Arch Linux
The MiniLibX library is included in the project as a submodule (
minilibx-linux/) and will be built automatically during compilation.Installation Steps
Initialize MiniLibX Submodule
If MiniLibX is included as a git submodule, initialize and update it:
If the
minilibx-linux/ directory is already present, you can skip this step.Build the Project
Compile the project using the provided Makefile:This command will:
- Compile the MiniLibX library in
minilibx-linux/ - Compile all C source files (*.c) in the project directory
- Link against required libraries:
-lmlx -lm -lX11 -lXext - Generate the
fractolexecutable
Makefile Targets
The project includes several useful Makefile targets:| Target | Description |
|---|---|
make or make all | Builds MiniLibX and compiles the fractol executable |
make clean | Removes all object files (*.o) |
make fclean | Removes object files and the executable |
make re | Performs a full rebuild (fclean + all) |
Compiler Flags
The project is compiled with strict warning flags to ensure code quality:-Wall: Enable all common warnings-Wextra: Enable extra warnings not covered by -Wall-Werror: Treat all warnings as errors
Troubleshooting
MiniLibX Build Fails
Problem: Error building MiniLibX library Solution: Ensure X11 development libraries are installed:Missing Math Library
Problem: Undefined references tosqrt, pow, or other math functions
Solution: The Makefile already includes -lm flag. Ensure your system has the math library:
Permission Denied
Problem: Cannot execute./fractol
Solution: Make the executable file executable:
Linking Errors with X11
Problem: Cannot find-lX11 or -lXext
Solution: Install X11 extension libraries:
Compilation Warnings as Errors
Problem: Build fails due to warnings being treated as errors (-Werror)
Solution: Fix the warnings in the source code. The strict flags ensure high code quality. If necessary for testing, you can temporarily modify the CFLAGS in the Makefile:
It’s recommended to fix warnings rather than disable
-Werror to maintain code quality.