#ifdef WIN32
#error This programme cannot compile at Windows Platform
#endif
注释:WIN32 是Windows下的预定义宏。当用户在Windows下编译该程序时,由于定义了WIN32这个宏,所以会执行#error命令,提示用户发生了编译错误,错误信息是:
This programme cannot compile at Windows Platform //这就是定义的错误
信息
#include <stdio.h>
int main()
{
#ifndef COMMAND
#error No defined Constant Symbol COMMAND
#endif
return 0;
}
注:说明COMMAND没有定义,报错。