title | ms.date | f1_keywords | helpviewer_keywords | ms.assetid | ||||
---|---|---|---|---|---|---|---|---|
#error directive (C/C++) |
08/29/2019 |
|
|
d550a802-ff19-4347-9597-688935d23b2b |
The #error directive emits a user-specified error message at compile time, and then terminates the compilation.
#error token-string
The error message that this directive emits includes the token-string parameter. The token-string parameter is not subject to macro expansion. This directive is most useful during preprocessing, to notify the developer of a program inconsistency, or the violation of a constraint. The following example demonstrates error processing during preprocessing:
#if !defined(__cplusplus)
#error C++ compiler required.
#endif