Pages

cc1: all warnings being treated as errors

While compiling big source codes, written in C, most often using make, we can pass many options called as flags, to gcc compiler, to control the behaviour of the compiler while compilation.

Encountering warnings in any code is common, but some times while running the make command we might hit the error.



This is because the compiler has been instructed not to ignore the warnings and treat all the warnings as errors. This is done by passing the options -Werror to gcc compiler. Ignoring warnings in bigger codes is not considered a good practice and to avoid the same the -Werror option is used.

For example the make file could have a like passing the options as below.



We can see that the last option is -Werror. This flag causes the error that we saw above. So if we do not want to treat warnings as errors, we just need to remove -Werror from the list of Target Flags. But be careful, it might not be the wisest thing to do.

No comments:

Post a Comment