是否可以关闭编译器警告

Is it possible to turn off compiler warnings?

本文关键字:编译器 警告 是否      更新时间:2023-10-16

如果我选择液位警告(全部)/墙

Studio显示来自此文件的许多警告:

wchar.h
math.h
xmemory0
xstring

示例:

代码

std::cout << "nn";

编译器

ios(116):警告C4710:std::string std::_Generic_error_category::message(int)const:

也许有一些宏观的,有些像这样?

#define start_warnings
#undef start_warnings

在Visual Studio中,/Wall启用了一些非常模糊的警告。它们可能很有用,例如定位具有填充字节的结构,但通常都是过度使用的,并且系统头在这个级别上没有被设计为无警告的。请改用/W4

如果确实需要调整级别或启用/禁用特定警告,请参阅#pragma warning