Just as the title says. I want to use a preprocessor macro in the text of an #error statement:
#define SOME_MACRO 1
#if SOME_MACRO != 0
#error \"SOME_MACRO
#define INVALID_MACRO_VALUE2(x)
#define INVALID_MACRO_VALUE(x) INVALID_MACRO_VALUE2(x)
#if SOME_MACRO != 0
#include INVALID_MACRO_VALUE(SOME_MACRO)
#endif
generates "Cannot open include file: 'invalid_macro_value_1': No such file or directory" in Visual Studio 2005 and probably similar messages on other compilers.
This doesn't answer your question directly about using #error, but the result is similar.