Equivalent in C ++ Builder is the #warning directive. Line:
#warning Test warning message here
Shows the following in the Messages panel:

It acts like any other compiler message, and with a double click you get into a line of code.
The __FILE__ and __LINE__ do not expand inside the message that you define using #warning - it accepts the text and spits it out exactly as it is written. However, you do not need to use them, since the message that emitted in any case includes a file and a line number.
If you want to write an error message (since Delphi allows - $MESSAGE has a level of memory, hints, warnings or errors), you can use #error . It works just like #warning and stops compiling on this line like any other error compilation, therefore
#error This is an error message
gives

I use C ++ Builder 2010 , but I am confident that these directives worked for many versions.
(By the way, marking the C ++ Builder βdelphiβ question is usually fine, since many questions about the IDE or VCL will answer both communities equally. I do this all the time. This is probably not one of those questions, since Delphi people are unlikely whether they learn about specific C ++ Builder compiler directives. The mark "C ++ - builder" by itself is okay.)
source share