print numeric value in compiler messages

320 views Asked by At

I'm not widely knowledgable with C++Builder. How do I print some numeric and hex values via compiler message?

#pragma message <text>

I found some example from this link below but it does not seem to be working:

Print numeric value of a define that's based on other macros via pragma message?

Here is an example:

#define __MY_CONDITIONAL_MACROS
#define __MY_NUMERIC_MACROS 0xA00
#define __MY_STRINGS_MACROS "some text"

#ifdef __MY_CONDITIONAL_MACROS
   /* how to print value */
   #pragma message (__MY_NUMERIC_MACROS)  
#else
   /* it's working for char or string */
   #pragma message __MY_STRINGS_MACROS
#endif

/* here an error code to test */
#pragma message __MY_NUMERIC_MACROS
/* [bcc32c Error] activesock.c(44): pragma message requires parenthesized string*/
#pragma message (__MY_NUMERIC_MACROS) 
/* [bcc32c Error] activesock.c(44): expected string literal in pragma message */
#pragma message __MY_STRINGS_MACROS /* OK */
0

There are 0 answers