【#pragma warning】
#pragma warning(disable:4507 34;once:4385;error:164)
等价于
#pragma warning(disable:4507 34) //不显示4507和34号警告信息
#pragma warning(once:4385) //4385号警告信息仅报告一次
#pragma warning(error:164) //把164号警告信息作为一个错误
【#pragma comment】
#pragma comment( lib, "xxx.lib") // 导入lib
【#pragma pack】
#pragma pack(push, 1) // 以一字节方式对齐
#pragma pack(pop) // 恢复原来对齐方式
【#pragma message】
#pragma message("编译时显示在输出窗口")
当我们在程序中定义了许多宏来控制源代码版本的时候,我们自己有可能都会忘记有没有正确的设置这些宏,此时我们可以用这条
指令在编译的时候就进行检查。
#ifdef LOG4Z_OEM_CONSOLE
#pragma message("log4z use console mode")
#endif
当定义了LOG4Z_OEM_CONSOLE这个宏以后,应用程序在编译时就会在编译输出窗口里显示"log4z use console mode"。