The #error Directive
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

The #error Directive

Error directives produce compiler-time error messages.

#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.

When #error directives are encountered, compilation terminates.

See Also

Preprocessor Directives

© 2015 Microsoft