gcc -Wall 옵션 플래그

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
$

 

-Wall 을 사용하여 myfile.c 빌드 :

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

 

 

 


또한보십시오

Advertising

GCC
°• CmtoInchesConvert.com •°