将所有警告视为错误,除了一些 [英] Treat all warnings as errors, except some
问题描述
在这个问题的答案中,gcc 将所有警告视为错误EXCEPT X 显示了如何将所有警告都视为错误,除了一个.
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
然后我们为上述规则添加例外(在这种情况下,错误称为deprecated
)
Then we add exceptions to the above rule (in this case error called deprecated
)
-Wno-error=deprecated
Microsoft Visual C++ 中是否有类似的方法?
Is there a similar method in Microsoft Visual C++?
推荐答案
没有
曾有用户建议将此类功能添加到 Visual C++,但该项目已被 Visual Studio 团队关闭 (https://visualstudio.uservoice.com/forums/121579-visual-studio-ide/suggestions/2597342-extend-c-to-treat-all-warnings-as-errors-except).
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?
这篇关于将所有警告视为错误,除了一些的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!