Treat all warnings as errors, except some

北城余情 提交于 2020-12-05 08:45:37

问题


In the answer to this question, gcc treat all warnings as errors EXCEPT X it is shown how all warnings can be treated as errors except one.

First we add the compiler flag that treats all warnings as errors:

-Werror

Then we add exceptions to the above rule (in this case error called deprecated)

-Wno-error=deprecated

Is there a similar method in Microsoft Visual C++?


回答1:


No.

There was a user suggestion to add such a feature to Visual C++, but the item was closed by the Visual Studio Team (https://visualstudio.uservoice.com/forums/121579-visual-studio-ide/suggestions/2597342-extend-c-to-treat-all-warnings-as-errors-except).

You can just treat specific warnings as errors: Can I treat a specific warning as an error?



来源:https://stackoverflow.com/questions/42868740/treat-all-warnings-as-errors-except-some

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!