c++ - 如何禁用包含文件夹的警告?

标签 c++ visual-studio warnings compilation

我必须使用一些库,无权更改或关心它, 每次我都会编译大量警告弹出窗口。没用的东西比如

: warning C4350: behavior change: 'std::auto_ptr<_Ty>::auto_ptr(std::auto_ptr_ref<_Ty>) throw()' called instead of 'std::auto_ptr<_Ty>::auto_ptr(std::auto_ptr<_Ty> &) throw()'

我想完全禁用对这个特定库的警告。 |但仍然希望对我自己的代码发出警告。在 Visual Studio 2010 中是否可行?

最佳答案

#pragma warning是一种选择,但它可能仅在您使用预编译头文件或您自己的项目中的源文件很少时才可行。

#pragma warning (push)
#pragma warning (disable : 4350)
#include <third/party/headers/in/question.h>
#pragma warning (pop)

关于c++ - 如何禁用包含文件夹的警告?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5151198/

相关文章:

MySQL IO操作超时

c++ - 为什么 Visual Studio Community 2017 C++ 标准是 C++98?

c++ - 如何在 Sun Studio 12 中禁用系统 header 的警告

c# - 无法解决 dll 之间的冲突

c++ - pthread_cond_wait 有时会收不到信号

c++ - 选择char数组中的单词,一一比较

c++ - OpenGl/Glew/GLSL 中的 Vec3 未定义

c++ - Win7 C++ 应用程序每次分配总是保留至少 4k 内存

c# - 无法加载 MyAssembly.XmlSerializers.dll。该系统找不到指定的文件

C++ - 特定于 gcc 的警告