A preprocessor error directive causes the preprocessor to generate an error message and causes the compilation to fail.
The #error directive is often used in the #else portion of a #if–#elif–#else construct, as a safety check during compilation. For example, #error directives in the source file can prevent code generation if a section of the program is reached that should be bypassed.
#define BUFFER_SIZE 255 #if BUFFER_SIZE < 256 #error "BUFFER_SIZE is too small." #endif
BUFFER_SIZE is too small.