Export (0) Print
Expand All
14 out of 18 rated this helpful - Rate this topic

The #error Directive

Error directives produce compiler-time error messages.


#error token-string

The error messages include the argument token-string and are currently not 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.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.