Go Up to Pragma Directives Overview Index
Syntax (See Pseudo-grammar)
#pragma message ("text" ["text"["text" ...]]) #pragma message text
#pragma message to specify a user-defined message within your program code.
The first form requires that the text consist of one or more string constants, and the message must be enclosed in parentheses. (This form is compatible with Microsoft C.) This form will output the constant contained between the double quotation marks regardless of whether it is a macro or not.
The second form uses the text following the #pragma for the text of the warning message. With this form of the #pragma, any macro references are expanded before the message is displayed.
The third form will output the macro-expanded value of text following the #pragma, if it is #defined. If it is not #defined, you'll get an ill-formed pragma warning.
User-defined messages are displayed as messages, not warnings.
Display of user-defined messages is on by default and can be turned on or off with the Show Messages option. This option corresponds to the compiler's -wmsg switch.
Messages are only displayed in the IDE if Show general messages is checked on the C++ Project Properties under Project > Options > Project Propertes.