与标题一样,如何在gcc/g ++上使用-Wall选项并关闭多行注释警告?
评论看起来像这样:
// Comment starts here \
// and end here (the // at the begging is not necessary)
Run Code Online (Sandbox Code Playgroud)
您可以使用/*..*/作为多行注释.
/* foo bar comment
lala blah
*/
Run Code Online (Sandbox Code Playgroud)
编辑:
我在另一篇文章中找到了一个解决方案:如何在GCC中隐藏"已定义但未使用"的警告?
如果添加选项-Wno-comment,则警告消失.
gcc -Wall -Wno-comment test.c -o test
Run Code Online (Sandbox Code Playgroud)
它也在这里解释:http: //gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
祝福马蒂亚斯