c++ - c illegal else without matching if -
okay, might shot in dark.
i'm writing software harness test code application using usb data transfer. can't post code online , can't give lot of specifics on code can post loop throwing bizarre error.
when attempt compile source file loop exists in, number of syntax errors (that can see don't apply) , error error c2181: illegal else without matching if
(which can see doesn't apply). know code works in it's normal operating environment, need test possible loopholes. have ideas?
here loop in particular. deals determining if message received usb complete:
void _usb_rx_complete(_message_union_t *buf_ptr) { if(buf_ptr == &s_msg_buf[0].buffer) { s_msg_buf[0].is_complete = 0; s_msg_buf[0].byte_index = 0; } else if(buf_ptr == &s_msg_buf[1].buffer) { s_msg_buf[1].is_complete = 0; s_msg_buf[1].byte_index = 0; } }
usually caused semi-colons after if statement i'm clean there. in addition, if comment out loop, don't of above errors don't think it's issue part of program. syntax errors error c2059: syntax error : '=='
anderror c2143: syntax error : missing ';' before '{'
within both if , else segment...any ideas?
thanks
your code has no obvious syntax error compiler still gives syntax errors output, points preprocessor related problem. since posting entire source code problem, here pointers how locate them;
to begin with, check #define
or macro defined in file, or symbol in failing expression know macro.
if not finding problem, this page tells how enable preprocessor output file in visual studio, inspecting output finding problem.
Comments
Post a Comment