Error:expected expression before '=' token
I am getting an error as expected expression before '=' token.
#define RMH_MAX_UNENCODED_LENGTH= (RMH_MESSAGE_MAX_SIZE - RMH_ENCODED_开发者_运维问答MSG_OVERHEAD); // RMH_MAX_UNENCODED_LENGTH =4064
#define RMH_MAX_ENCODED_LENGTH = (3*sizeof(RMH_MAX_UNENCODED_LENGTH) / 4);//RMH_MAX_ENCODED_LENGTH =4;
int k = RMH_MAX_UNENCODED_LENGTH; //Error:expected expression before '=' token
NSLog(@"f:%d",k);
Your syntax is wrong. Use:
#define RMH_MAX_UNENCODED_LENGTH (RMH_MESSAGE_MAX_SIZE - RMH_ENCODED_MSG_OVERHEAD)
Note: no =
, no ;
, no comment after it.
define
s are "simply" pure text substitutions.
You don't want an "=" or a ";" in those #define statements. The syntax is...
#define symbol value
It's a good idea to put parentheses as you've done.
This is just plain C, no "Ojbective" stuff here. You might want to pick up a book on C to learn things like this.
精彩评论