You would use ‘ #error ’ inside of a conditional that detects a combination of parameters which you know the program does not properly support. For example, if you know that the program will not run properly on a VAX, you might write
#ifdef __vax__ #error "Won't work on VAXen. See comments at get_last_object." #endif
If you have several configuration parameters that must be set up by the installation in a consistent way, you can use conditionals to detect an inconsistency and report it with ‘ #error ’. For example,
#if !defined(FOO) && defined(BAR) #error "BAR requires FOO." #endif
You might use ‘ #warning ’ in obsolete header files, with a message directing the user to the header file which should be used instead.
Neither ‘ #error ’ nor ‘ #warning ’ macro-expands its argument. Internal whitespace sequences are each replaced with a single space. The line must consist of complete tokens. It is wisest to make the argument of these directives be a single string constant; this avoids problems with apostrophes and the like.