I am trying to set a boolean, but it won开发者_开发百科't let me set it true. It keeps telling me that YES
is redefined. I am using the method #define YES (q1);
where q1
is the boolean.
BOOL yourBool = YES;
Why are you doing this?
#define YES (q1);
its a preprocessor macro to replace all occurences of the word YES with (q1) if thats what you actually want to do(you probably don't), then use BOOL yourBool=TRUE;
but its a really bad idea to redefine YES. don't.
I think the define
you are looking for is:
#define q1 YES
To verify:
NSLog(@"Q1 is set to %@", (q1 ? @"YES" : @"NO"));
if (q1)
{
// Do something funky
}
精彩评论