#error Directive
Preprocessor directive that produces compiler-time error messages.
#error token-string |
---|
Parameters
Item | Description |
---|---|
token-string |
Error message. This parameter consists of a series of tokens, such as keywords, constants, or complete statements. The token string is subject to macro expansion. |
Remarks
#error directives are most useful for detecting programmer inconsistencies and violation of constraints during preprocessing. When an #error directive is encountered, compilation terminates.
Examples
The following example demonstrates error processing during preprocessing.
#if !defined(__cplusplus)
#error C++ compiler required.
#endif
See also
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for