The #error Directive
Error directives produce compiler-time error messages.
Syntax
#error token-string
The error messages include the argument token-string and are subject to macro expansion. These directives are most useful for detecting programmer inconsistencies and violation of constraints during preprocessing. The following example demonstrates error processing during preprocessing:
#if !defined(__cplusplus)
#error C++ compiler required.
#endif
When #error directives are encountered, compilation terminates.
_________________________________________________________
message
#pragma message( messagestring )
Sends a string literal to the standard output without terminating the compilation. A typical use of the message pragma is to display informational messages at compile time.
The following code fragment uses the message pragma to display a message during compilation:
#if _M_IX86 == 500
#pragma message( "Pentium processor build" )
#endif
The messagestring parameter can be a macro that expands to a string literal, and you can concatenate such macros with string literals in any combination. For example, the following statements display the name of the file being compiled and the date and time when the file was last modified:
#pragma message( "Compiling " __FILE__ )
#pragma message( "Last modified on " __TIMESTAMP__ )