c++ - 是否可以禁用编译器警告 C4503?

标签 c++ visual-studio warnings pragma suppress-warnings

以下代码不会抑制任何 C4503 编译器警告,但会抑制 C4244 警告。

#pragma warning(push)
#pragma warning(disable:4503)
#pragma warning(disable:4244)

#include <map>
#include <string>

int main(int argc, char *argv[])
{
    class Field;
    typedef std::map<std::string, Field * > Screen;
    typedef std::map<std::string, Screen> WebApp;
    typedef std::map<std::string, WebApp> WebAppTest;
    typedef std::map<std::string, WebAppTest> Hello;
    Hello MyWAT; // The C4503 error is NOT suppressed

    int a;
    a = 5.0f; // The C4244 error is suppressed
}

#pragma warning(pop)

请明确解释为什么未抑制 C4503 警告。注意:这可能是由于与 How can I work around warning C4505 in third party libraries? 中引用的类似原因造成的.

参见 thisthis获取更多相关信息。

我在 Windows 7 机器上使用 Visual Studio 2008。

最佳答案

从上下文看不清楚,但也许你有太多的 #pragma 语句? MSDN 说:

 The compiler only supports up to 56 #pragma warning statements in a compiland.

关于c++ - 是否可以禁用编译器警告 C4503?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9673504/

相关文章:

python - 我可以在自定义 Tkinter Toplevel() 窗口上获取消息框的图标 ="warning"噪音吗?

c++ - 如何让运算符从对象的左侧开始工作?

c++ - posix信号 react 时间

php - 如何在 Windows 上为 php-src 生成 .sln

c++ - 枚举警告 : outside the range

安卓警告 : Grows due to localized text expansion

c++ - 哪些平台具有不兼容的 C 和 C++ ABI?

c++ - 如何将条件约束转换为 cplex 的 Concert C++?

database - 在 Visual Studio 中定义多个外键

.net - 如何从 Visual Studio 解决方案启动特定项目