sinalizador de opção gcc -Wall

gcc -Wall ativa todas as mensagens de aviso do compilador. Esta opção deve ser sempre usada para gerar um código melhor.

Sintaxe

$ gcc -Wall [options] [source files] [object files] [-o output file]

Exemplo

Grave o arquivo de origem myfile.c :

// myfile.c
#include <stdio.h/

int main()
{
    printf("Program run!\n");
    int i=10;
}

 

A compilação regular de myfile.c não fornece mensagens:

$ gcc myfile.c -o myfile
$

 

Compilação de myfile.c com -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
$

 

 

 


Veja também

Advertising

GCC
TABELAS RÁPIDAS