Hi,
I've distilled my problem down to this code snippet - but it is a part of a larger program so I don't want a different way to do this - I need a way to make this work!
When I generate a preprocessed file from this code:
#define OUTER(a, b) \
a##b
#define INNER(c, d) \
c##d
enum foo {
OUTER(INNER(x, y), z)
}; // line 108
int APIENTRY _tWinMain(...)
{
foo bar = xyz; // line 112
}
I get:
enum foo {
xyz
}; // line 108
int __stdcall wWinMain(...)
{
foo bar = xyz; // line 112
}
which is what I want. However, if I try to compile the code I get:
error C2146: syntax error : missing '}' before identifier 'z' line 108
error C2143: syntax error : missing ';' before '}' line 108
error C2143: syntax error : missing ';' before '}' line 108
error C2059: syntax error : '}' line 108
error C2065: 'xyz' : undeclared identifier line 112
I can't work it out! The problem seems to be caused by the ##
in the:
#define OUTER(a, b) \
a##b
but why (and how to fix it) is beyond me...