Ravi Uday <ra*****@yahoo.com> spoke thus:
Why is this code not working ?
It says " 'TestFn_this_is_new_string' : undeclared identifier"
#define NEW_STR(x) {x##_this_is_new_string }
struct command
{
char *name;
}cm[10] = {NEW_STR(testFn)} ;
Well, after the macro substitution, you get
struct command
{
char *name;
} cm[10] = {testFn_this_is_new_string} ;
First, note that the error message you posted has a capital T, while
the string you're using for the macro argument has a lowercase t. C
is case-sensitive, so that could be your problem right there. If not,
it's probably as Joona suggested - you just didn't declare this
oddly-named variable anywhere.
--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.