====== error ======
#error your error_message
==== description of error ====
The #error directive emits a user-specified error message at compile time and then terminates the compilation.
The following code will cause in compilation error:
#include
int main()
{
printf("code-reference.com/c");
return 0;
}
#if !defined(PASS_COMPILER)
#error Syntax to Pass this stage is required !
#endif
The following code will compile:
#define PASS_COMPILER /*You can write this definition here or any*/
#include
int main()
{
printf("code-reference.com/c");
/*#define PASS_COMPILER*/
return 0;
}
#if !defined(PASS_COMPILER)
#error Syntax to Pass this stage is required !
#endif
===== output of error c example =====
In first program:
No output, because __"PASS_COMPILER"__ is __not defined__ in program, so __compilation terminates__ with Error Message as shown:
//"\main.c|4|error: #error Syntax to Pass this stage is required !|"//
In the Second program:
Output will be:
code-reference.com/c