错误指令
来自cppreference.com
< c | preprocessor
显示给定的错误消息,并令程序为病式。
目录 |
[编辑] 语法
#error 错误消息
|
|||||||||
[编辑] 解释
实现在遇到 #error 指令后,显示诊断消息 错误消息 ,并令程序为病式(停止编译)。
错误消息 可由多个词组成,不必在引号中。
[编辑] 示例
运行此代码
#if __STDC__ != 1 #error "Not a standard compliant compiler" #endif #include <stdio.h> int main (void) { printf("It is a Standard compiler conforming to ISO C Standard !!"); }
可能的输出:
It is a Standard compiler conforming to ISO C Standard !!