I tried
#error MY_DEFINE
But all that did is echo “MY_DEFINE” when it threw the error.
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.