VS2013:如何禁用项目外部包含的头文件的警告

时间:2014-06-30 04:33:04

标签: c++ visual-studio-2013 warnings compiler-warnings suppress-warnings

在我的项目中,我包含了一个由外部库提供的头文件。使用/ W3,所有内容都会编译而不会发出警告。但是,我想用/ W4干净地编译我的项目。对我的代码来说没有问题,但是外部标题会发出大量警告。我知道我可以这样做:

#pragma warning( push )
#pragma warning( disable: #### )
// include here
#pragma warning( pop )

但是有很多警告要禁用。有没有一种方法可以在包含此标题时将警告级别设置回/ W3,同时仍然使用/ W4编译其余代码?

谢谢!

1 个答案:

答案 0 :(得分:1)

#pragma warning(push, 3)
// include here
#pragma warning(pop)

有关详细信息,请参阅the documentation

相关问题