如何在VS2013社区中禁用警告C4927
How to disable warning C4927 in VS2013 Community
我在项目中收到以下警告:
warning C4927: illegal conversion; more than one user-defined conversion has been implicitly applied while calling the constructor 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(const _Elem *)'
with
[
_Elem=char
]
C:Program Files (x86)Microsoft Visual Studio 12.0VCincludexstring(778) : see declaration of 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string'
我理解为什么会发生这种情况,只是无法抑制它。我已尝试将它添加到项目设置中的"禁用特定警告"列表中,还将警告级别设置为"关闭所有警告"(/W0),但警告仍然存在。有人对如何隐藏信息有什么建议吗?
您可以使用#pragma warning
直接在代码中控制Visual Studio警告(https://msdn.microsoft.com/en-us/library/2c8f766e.aspx)。如果你想让一行的警告静音,你可以在该行之前立即放置以下内容:
#pragma warning (suppress: 4927)
line-that-causes-warning-4927
您也可以从#pragma
之后的任何点禁用它,方法是使用"disable"而不是"suppress"。然而,正如评论所建议的那样,最好实际修复警告,因为它可能会导致程序出现问题。
相关文章:
- 警告处理为错误这里有什么问题
- 使用动态分配的数组会导致代码分析发出虚假的C6386缓冲区溢出警告
- cppcheck在const std::string[]上引发警告
- GCC对可能有效的代码抛出init list生存期警告
- 如何在BST的这个简单递归实现中消除警告
- 关于std::move的使用,是否有编译警告
- g++ 在某个类成员未初始化时不发出警告
- 如何处理来自核心指南检查器的关于gsl::at的静态分析警告
- 使用typeid警告未使用的变量
- 示例C++项目编译中的警告
- 警告:在函数返回类型 [-Wignore 限定符] 时忽略类型限定符
- 如何修复编译器警告 C6386 和 C6385?
- 返回语句后的代码,没有警告
- 获取隐式转换溢出从无符号到已签名的警告
- 编译器警告:执行到达值返回函数的末尾而不返回值
- 在未链接的部分上生成警告
- 警告 C4552:">>":未使用表达式的结果
- 禁止显示由于常量为零而比较始终为假的警告
- C++ 警告:将新创建的 gsl::owner<> 分配给非所有者
- 如何在VS2013社区中禁用警告C4927