Chr*_*ris 8 c++ warnings pragma suppress-warnings visual-studio
以下代码不会抑制任何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)
Run Code Online (Sandbox Code Playgroud)
请明确解释为什么不抑制C4503警告.注意:这可能是由于我如何在第三方库中解决警告C4505中引用的类似原因?.
我在Windows 7机器上使用Visual Studio 2008.
从上下文看不清楚,但也许你的#pragma陈述太多了?MSDN 说:
The compiler only supports up to 56 #pragma warning statements in a compiland.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5864 次 |
| 最近记录: |