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

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

xcode 7 how to suppress warning "overrides a member function but is not marked 'override'"

c++xcodec++11clang

提问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-overrideflag which automatically gets added with -Wallon recent versions of clang. You can do this by passing the -Wno-inconsistent-missing-overrideflag. See.

您需要关闭在最新版本的 clang 上-Winconsistent-missing-override自动添加的标志-Wall。您可以通过传递-Wno-inconsistent-missing-override标志来做到这一点。