我对C ++ Builder并不了解。如何通过编译器消息打印一些数字和十六进制值?
#pragma message <text>
我从下面的此链接中找到了一些示例,但它似乎不起作用:
Print numeric value of a define that's based on other macros via pragma message?
这里是一个例子:
#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 */