问题描述
在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
但是我的问题是,
给出编译器警告
/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?
推荐答案
我不确定100%,但是-Wdelete-non-virtual-dtor
可能是有问题的警告,因此您需要-Werror=delete-non-virtual-dtor
.
I'm not 100% sure, but -Wdelete-non-virtual-dtor
might be the warning in question, so you'd need -Werror=delete-non-virtual-dtor
.
这篇关于将警告转换为错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!