抑制 g++来自类型“A”的警告转换;输入“B”抛弃常量
我正在使用 g++,正在编译一个 linux c++ 项目。我得到
src/fileC.cpp:181618: warning: cast from type 'const t__DeviceID*' to type 't__DeviceID*' casts away constness
是否有任何 -W 选项可以抑制该警告?
在正常情况下,我们会按照编译器的建议解决该警告,但对于这个文件(不是我们的代码),我们不想修改它,至少现在是这样。
I am using g++ and I am compiling a linux c++ project. I get
src/fileC.cpp:181618: warning: cast from type 'const t__DeviceID*' to type 't__DeviceID*' casts away constness
Is there any -W option that suppresses that warning?
In normal cases we resolve that warnings, following the suggestion of the compiler, but for this file - which is not our code - we don't want to modify it, at least for now.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
虽然
-Wno-cast-qual
可能是您想要的,但您通常还可能需要向 gcc 添加-fdiagnostics-show-option
选项,该选项将向您显示对于几乎所有的诊断,哪个参数导致了它。While
-Wno-cast-qual
is probably what you want, you also might want to add in general the-fdiagnostics-show-option
option to gcc, which will show you for almost all diagnostics which parameter caused it.