I am working on 32-bit Fedora 14 system. I'm compiling my source code using gcc
.
Does anybody know how to disable warnings while compiling c code?
EDIT: Yes i know. Best thing is to fix those Warnings to avoid any undefined/unknown behavior. But currently here, i have written huge code first time and there are lots of error & warning in first compilation. Here i just want to concentrate on errors first and then i will see warnings.
The short answer: Use "-w" to ignore warnings.
To answer your question about disabling specific warnings in GCC, you can enable specific warnings in GCC with -Wxxxx and disable them with -Wno-xxxx. From the GCC Warning Options: You can request many specific warnings with options beginning -W , for example -Wimplicit to request warnings on implicit declarations.
To disable a set of warnings for a given piece of code, you have to start with a “push” pre-processor instruction, then with a disabling instruction for each of the warning you want to suppress, and finish with a “pop” pre-processor instruction. Now let's dive into the code for each compiler.
Unlike compilation errors, warnings don't interrupt the compilation process. They are not errors from the viewpoint of a programming language, but they may be software bugs. However, many compilers can be customized so that their warnings don't stop the compilation process.
try to add -w option when compiling
http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
Every body tells use -Wall
switch with gcc, but you want to disable it. It is not advised, Use debugger to find it.
Linus Torvalds:
"But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With