The #error preprocessor directive indicates error. The compiler gives fatal error if #error directive is found and skips further compilation process.
Let's see a simple example to use #error preprocessor directive.
#include#ifndef __MATH_H #error First include then compile #else void main(){ float a; a=sqrt(7); printf("%f",a); } #endif
Output:
But, if you include math.h, it does not gives error.
#include#include #ifndef __MATH_H #error First include then compile #else void main(){ float a; a=sqrt(7); printf("%f",a); } #endif
Output: