Article ID: 155196 - View products that this article applies to.
This article was previously published under Q155196
In some instances, you may find it advantageous to have the compiler generate user-defined warning messages such as the following:
When such a warning is generated by the compiler and displayed in the Developer Studio's Output window, you can double-click on the warning message to get to the line of code with the message.
collisions.cpp(1) : Warning Msg: Need to do 3-D collision checking
The following code illustrates how to use the #pragma message to force the compiler to generate the above warning message. Note the spacing around the colons in the third #define statement. The Visual Workbench that ships with the 16-bit versions of Visual C++ does not recognize a double-click in the Output window unless the proper spacing exists between the colons.
For additional information concerning the #pragma message directive, see the Visual C++ Help file; Search on: "message (pragma directive)."
For additional information concerning the __FILE__ and __LINE__ predefined macros, see the Visual C++ Help file; Search on: "predefined macros," Topic: "Preprocessor Reference," and click on "ANSI."
Article ID: 155196 - Last Review: June 2, 2005 - Revision: 4.0
Contact us for more help
Connect with Answer Desk for expert help.