#error 指令用于在编译期间产生错误信息,并阻止程序的编译,其形式如下: #error error_message 例如,我们的程序针对 Linux 编写,不保证兼容 Windows,那么可以这样做: #ifdef WIN32 #error This programme cannot compile at Windows Platform #endif WIN32 是 Windows 下的预定义宏.当用户在 Windows 下编译该程序时,由于定义了 WIN32 这个宏,所以会执行 #err