Search code examples
c++ubuntu-15.10

a simple typographical erro


gcc -wall -w -werror hello.cpp -o hello

show me : gcc: error: unrecognized command line option ‘-wall’ ,and ==> gcc: error: unrecognized command line option ‘-werror’


Solution

  • Try -Wall with captial W. The command line options are case senstive.

    -Wall This enables all the warnings about constructions that some users consider questionable, and that are easy to avoid (or modify to prevent the warning), even in conjunction with macros. This also enables some language-specific warnings described in C++ Dialect Options and Objective-C and Objective-C++ Dialect Options.

    And for the werror, use -Werror with captial W

    -Werror= Make the specified warning into an error. The specifier for a warning is appended; for example -Werror=switch turns the warnings controlled by -Wswitch into errors. This switch takes a negative form, to be used to negate -Werror for specific warnings; for example -Wno-error=switch makes -Wswitch warnings not be errors, even when -Werror is in effect. The warning message for each controllable warning includes the option that controls the warning. That option can then be used with -Werror= and -Wno-error= as described above. (Printing of the option in the warning message can be disabled using the -fno-diagnostics-show-option flag.)

    Note that specifying -Werror=foo automatically implies -Wfoo. However, -Wno-error=foo does not imply anything.

    https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html