更改第 3 方库的警告级别 [英] Changing Warning Level for 3rd Party Libs

查看:28
本文介绍了更改第 3 方库的警告级别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通常喜欢在 Visual Studio 中针对警告级别 4 进行编译,并将所有警告视为错误.问题是,Ogre3D 没有编译为警告级别 3(FBX SDK 或 OIS,我也在使用),这造成了一个问题,因为现在我有大量来自 Ogre3D 库的警告,这些警告现在被视为错误.到目前为止,我一直在编译级别 3,但这让我非常不安.有没有办法禁用我无法控制的特定 3rd 方库的警告?

I generally like to compile against warning level 4 in Visual Studio and treat all warnings as errors. The problem is, Ogre3D is not compiled with warning level 3 (neither is FBX SDK or OIS, which I am also using), and that poses a problem because now I have a ton of warnings from Ogre3D libraries that are now treated as errors. So far I have been compiling at level 3, but that makes me very uneasy. Is there any way to disable warnings for specific 3rd party libraries over which I have no control?

推荐答案

你没有具体说明你是如何编译的,但这里有一些选项:

You don't say exactly how you are compiling, but here are some options:

1 - 在 Visual Studio 中,您可以通过每个源文件的属性设置单个源文件的警告级别

1 - Inside Visual Studio, you can set the warning level for individual source files via the Properties for each source file

2 - 您还可以使用

2 - You can also change the the warning level dynamically within a file using

#pragma warning(push, 3)
// Some code, perhaps #includes
#pragma warning(pop)

将两个编译指示之间的警告级别设置为 3.

which sets the warning level to 3 between the two pragmas.

这篇关于更改第 3 方库的警告级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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