禁用 C++项目级别的警告?

发布于 2024-12-14 15:19:42 字数 161 浏览 5 评论 0原文

我知道您可以使用#pragma 禁用特定文件中的警告,但我想“关闭”整个 VC++ 2008 项目的某个警告。

我找到了一个选项配置属性->C/C++->高级->禁用特定警告但是当我输入数字警告代码并重新编译有问题的.cpp文件时,警告仍然生成了。

I know you can use a #pragma to disable a warning in a specific file, but I want to "turn off" a certain warning for a whole VC++ 2008 project.

I found an option Configuration Properties->C/C++->Advanced->Disable Specific Warnings but when I entered the numeric warning code and re-compiled the .cpp file in question, the warning was still generated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

闻呓 2024-12-21 15:19:42

如果您的项目包含其他项目或使用其他项目中的对象,请确保在发生警告的项目上添加警告禁用。这应该总是有效。

If your project includes other projects or uses objects from another project, make sure you add the warning disable on the project where the warning occurs. This should always work.

烙印 2024-12-21 15:19:42

尝试使用预编译头并在那里放置警告禁用代码。它对我有用,警告 C4005。

Try to use precompiled header and put warnings disable code there. It worked for me with warning C4005.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文