如何抑制 Xcode 中的警告?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18965782/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 03:53:30  来源:igfitidea点击:

How to suppress warnings in Xcode?

iosxcodecompiler-constructioncompiler-warningsxcode5

提问by Pablo

In Xcode 5, is there any way to suppress warnings such as unused variables for number of files? Particularly latest Box2D 2.2.1 produces some warnings which are annoying but harmless.

在 Xcode 5 中,有没有办法抑制警告,例如文件数量的未使用变量?特别是最新的 Box2D 2.2.1 会产生一些令人讨厌但无害的警告。

回答by jaredsinclair

You can add a compiler flag -wfor each affected .m file you want silenced, in the build phases for your app's target, under "Compile Sources."

您可以-w在应用程序目标的构建阶段中,在“编译源”下,为您想要静音的每个受影响的 .m 文件添加一个编译器标志。

回答by Susheel Athmakuri

Select the project in the navigator, then select the target from the list. Select the Build Phases tab, then expand the Compile Sources phase. The Compiler Flags column is where you specify per-file compiler flags. Enter -Wno- to negate a warning. e.g.: -Wno-unused-parameter

在导航器中选择项目,然后从列表中选择目标。选择 Build Phases 选项卡,然后展开 Compile Sources 阶段。Compiler Flags 列是您指定每个文件编译器标志的地方。输入 -Wno- 取消警告。例如:-Wno-unused-parameter