I always compile with -Wall -Wextra -Werror
.
However many times as I do quick compile tests I need to ignore the -Wunused
suit of errors. For various reasons I want to see them as warnings and not errors while leaving all other warnings as errors.
-Wno-unused
of course doesn't display any warning so is not what I need.
The one I thought is the solution -Wno-error=unused
unfortunately doesn't seem to work (they are still reported as errors),
Individually setting the flags (e.g. -Wno-error=unused-variable
) works as expected (reported as warning only).
So is there a way to make them warnings while leaving -Werror
without to specify all the suit of options -Wno-error=unsused-...
individually?
Is the behavior of -Werro -Wno-error=unused
a bug?
When you invoke GCC, it normally does preprocessing, compilation, assembly and linking. The "overall options" allow you to stop this process at an intermediate stage. For example, the -c option says not to run the linker.
fPIC option in GCC enables the address of shared libraries to be relative so that the executable is independent of the position of libraries. This enables one to share built library which has dependencies on other shared libraries. fPIC stands for "force Position Independent Code".
In the question“What are the easiest to use C++ compilers and IDEs?” Microsoft Visual C++ is ranked 2nd while GCC is ranked 3rd. The most important reason people chose Microsoft Visual C++ is: To get C++ running on a build machine, just copy the VC bin, and all the headers/libraries you'll need.
No there is no way to turn them off at once.
-Wunused
enable list of options like:-Wunused-function
-Wunused-label
-Wunused-value
-Wunused-variable
And you should disable them one by one with Wno
option.
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