| xHarbour Reference Documentation > Preprocessor Reference |
![]() |
![]() |
![]() |
Raises an explicit compiler error along with a message.
#error [<errMessage>]
The #error directive instructs the preprocessor to raise an error and display the message text specified with <errMessage>. The message text is output on Stdout so that it can be collected in a file.
This directive is only used in conjunction with conditional compilation.
| See also: | #command | #translate, #define, #if, #ifdef, #ifndef, #stdout |
| Category: | Preprocessor directives |
// The example demonstrates a scenario where the #error directive
// is useful. An error message is output when a particular #define
// constant exists.
#define DEMO_VERSION
PROCEDURE Main
#ifdef DEMO_VERSION
#error Do not include DEMO code in production version
#endif
? "Normal statements"
ENDIF
http://www.xHarbour.com