一个简单的印刷错误

a simple typographical erro

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

告诉我:gcc:错误:无法识别的命令行选项“-wall” ,and ==> gcc: 错误: 无法识别的命令行选项‘-werror’

尝试 -W 全部使用大写字母 W。命令行选项区分大小写。

-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.

对于错误,使用 -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