xHarbour Reference Documentation > Preprocessor Reference xHarbour Developers Network  

#error

Raises an explicit compiler error along with a message.

Syntax

#error [<errMessage>]

Arguments

<errMessage>
If specified, this is a text to display when the #error directive is processed.

Description

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.

Info

See also:#command | #translate, #define, #if, #ifdef, #ifndef, #stdout
Category: Preprocessor directives

Example

// 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

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe