将警告转换为错误 [英] Convert Warning to Error
本文介绍了将警告转换为错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Windows中,VC ++具有一个漂亮的选项/We 进行转换特定的错误警告.同样,VC ++发出的每个警告都有一个警告编号,例如
In Windows, VC++ has a nifty option /We to convert a specific warning to error. Also every warning emitted by VC++ has a warning number for example
warning C4265: 'CFoo' : class has virtual functions, but destructor is not virtual
因此,使用/We可以轻松识别数字并添加编译器选项切换为/We4265
So it easy to identify the number and add a compiler option using the /We switch as /We4265
我检查了g ++文档并发现了类似的内容(我相信), -Werror = ,但文档中提到
I checked the g++ documentation and found something similar (I believe), -Werror=, but the documentation mentions
将指定的警告变为错误.
Make the specified warning into an error.
但是我的问题是,
给出编译器警告
/yada/yada/src/inc/module.h:580: warning: 'struct IFoo' has virtual functions but non-virtual destructor
如何使用-Werror
编译器选项将其转换为错误?
How do I convert this to error using the -Werror
compiler option?
推荐答案
查看全文