如何配置Visual Studio不从库中输出警告? [英] How to configure Visual Studio not to output warnings from libraries?

查看:108
本文介绍了如何配置Visual Studio不从库中输出警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以防止Visual Studio从包含的库中打印出警告吗?

Is there any way to prevent Visual Studio from printing out warnings from included libraries?

\尽管我可以将墙壁从STL和Qt标头中获取警告,只希望看到那些源于我自己的代码(即该代码是当前Visual Studio项目的一部分)。

\Wall gives me loads of warnings from STL and Qt headers, although I only want to see those originating from my own code (i.e. the code which is part of the current Visual Studio project).

推荐答案

您可以使用pragma设置每个文件的警告级别。

You can use pragma to set the warning levels for each file.

因此,在您添加该文件之前

So before you include

#pragma warning( push )
#pragma warning( disable : 4705 )
#pragma warning( disable : 4706 )
#pragma warning( disable : 4707 )
// Some code

#include your files here

#pragma warning( pop ) 

此处提供更多信息: http://msdn.microsoft.com/en-us/library/2c8f766e%28v=vs.80%29.aspx

这篇关于如何配置Visual Studio不从库中输出警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆