Compile it with "-Werror" will result a fail unless you uncomment "#include <stdio.h>":
$ gcc -Werror -o werror werror.c
cc1: warnings being treated as errors
werror.c: In function ‘main’:
werror.c:13: warning: incompatible implicit declaration of built-in function ‘printf’
Using gcc option -Werror
It's a good practice to make "-Werror" a default option of your program.
"-Werror" will make all warnings into errors. That means you cannot get you program compiled with even warnings.
Take the following code for example:
Compile it with "-Werror" will result a fail unless you uncomment "#include <stdio.h>":
Categories
Feeds
Tags
Copyright © 2012 Zhigang Wang. Some right reserved.
The views expressed on this web site are my own and do not necessarily reflect the views of Oracle.