gcc -Wall opció jelzője

A gcc -Wall engedélyezi a fordító összes figyelmeztető üzenetét.Ezt az opciót mindig használni kell a jobb kód generálása érdekében.

Szintaxis

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

Példa

Írja be a myfile.c forrásfájlt :

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

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

 

A myfile.c normál buildje nem ad üzenetet:

$ gcc myfile.c -o myfile
$

 

A myfile.c felépítése a -Wall segítségével:

$ 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
$

 

 

 


Lásd még

Advertising

GCC
°• CmtoInchesConvert.com •°