views:

28

answers:

1

I tried #error MY_DEFINE But all that did is echo "MY_DEFINE" when it threw the error.

Thanks!

+1  A: 

You can tell the compiler to save the preprocessor output (/E or /EP) and then look at that file. That's usually how I debug problems related to macro expansion.

If you're trying to make some cool error facility for a library, you might be out of luck. I think you'll have a hard time getting the preprocessor to expand a macro into a compile-time message. Perhaps if you combined a template trick that used the macro, you could get it to appear in a cryptic compiler error message.

Adrian McCarthy
Thanks, I'll take a look at that.
RobotCaleb