Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

#error Directive (C/C++)

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at #error Directive (C/C++). The #error directive emits a user-specified error message at compile time and then terminates the compilation.

#errortoken-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 for notifying 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  

Preprocessor Directives

Show:
© 2018 Microsoft