gcc -Wall מאפשר את כל הודעות האזהרה של המהדר. תמיד יש להשתמש באפשרות זו על מנת ליצור קוד טוב יותר.
$ gcc -Wall [options] [source files] [object files] [-o output file]
כתוב את קובץ המקור myfile.c :
// myfile.c
#include <stdio.h>
int main()
{
printf("Program run!\n");
int i=10;
}
מבנה רגיל של myfile.c לא נותן הודעות:
$ gcc myfile.c -o myfile
$
בנייה של myfile.c עם -Wall:
$ gcc -Wall myfile.c -o myfile
myfile.c In function 'main':
myfile.c:6:6: warning: unused variable 'i'
myfile.c:7:1: warning: control reaches end of non-void function
$