如何禁用在 XCode 中被标记为错误的警告

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1150335/
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-14 18:41:29  来源:igfitidea点击:

How do I disable warnings being flagged as errors in XCode

objective-cxcodemacos

提问by Rob Segal

Is there a setting XCode that lets you treat warnings NOT as errors in XCode? I'm doing alot of prototyping code where I don't care if I have an unused variable for example. XCode is treating these warnings as errors and it is seriously slowing down my productivity. Can't figure out how to disable this though.

是否有设置 XCode 可以让您将警告视为 XCode 中的错误?例如,我正在做很多原型代码,我不在乎是否有未使用的变量。XCode 将这些警告视为错误,这严重降低了我的工作效率。虽然无法弄清楚如何禁用它。

采纳答案by Kevin Horgan

If you open your project in XCode, then right click on your target in the Targets folder. Select "Get Info" form the drop down menu and then scroll down to the section for the compiler warnings (GCC 4.0 Warnings on my box). Here you can disable the checkboxes for the various warnings you have active. Also check the value of "Other Warning Flags". This could include -Wall or -WMost which will enable other warnings. You can remove that and hopefully your warnings will not appear.

如果您在 XCode 中打开您的项目,则右键单击 Targets 文件夹中的目标。从下拉菜单中选择“获取信息”,然后向下滚动到编译器警告部分(我的盒子上是 GCC 4.0 警告)。您可以在此处禁用您已激活的各种警告的复选框。还要检查“其他警告标志”的值。这可能包括 -Wall 或 -WMost,这将启用其他警告。您可以删除它,希望您的警告不会出现。

Good luck!

祝你好运!

回答by Nikolai Ruhe

In the build settings of your target there's an option named Treat Warnings as Errors. If it is on in your project, turn it off (even though this is the default).

在目标的构建设置中,有一个名为Treat Warnings as Errors的选项。如果它在您的项目中打开,请将其关闭(即使这是默认设置)。