xcode 7 如何抑制警告“覆盖成员函数但未标记为‘覆盖’”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32626171/
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
xcode 7 how to suppress warning "overrides a member function but is not marked 'override'"
提问by Rong Yang
I updated xcode to 7 today. After the update the project I am working on has the warning "overrides a member function but is not marked 'override'". Since our project set "treade warning as error" to true. I got lots of errors.
我今天将 xcode 更新为 7。更新后,我正在处理的项目出现警告“覆盖成员函数但未标记为‘覆盖’”。由于我们的项目将“tread warning as error”设置为true。我有很多错误。
I double checked "Other Linker Flags" and pretty sure the flag "-Wsuggest-override" is not included.
我仔细检查了“其他链接器标志”,很确定不包括标志“-Wsuggest-override”。
Since it is a big project I prefer to suppress the warning instead add the keyword "override" everywhere.
由于这是一个大项目,我更喜欢抑制警告,而不是在任何地方添加关键字“覆盖”。
Any suggestion for disabling the warning?
关于禁用警告的任何建议?
Thanks
谢谢
回答by sjdowling
You need to turn off the -Winconsistent-missing-override
flag which automatically gets added with -Wall
on recent versions of clang. You can do this by passing the -Wno-inconsistent-missing-override
flag. See.
您需要关闭在最新版本的 clang 上-Winconsistent-missing-override
自动添加的标志-Wall
。您可以通过传递-Wno-inconsistent-missing-override
标志来做到这一点。见。