I am facing a problem with a macro and I can't figure out why.
Here is the macro :
#define WAIT(condition, max_time)               \
   do {                                         \
      int int_loop_wait=0;                      \
      while(1)                                  \    
      {                                         \           
        if(condition) { break; }                \
        sleep(1);                               \
        if(int_loop_wait>=max_time) { break; }  \
        int_loop_wait++;                        \
      }                                         \
    } while(0)                                  \
I got the error
"expected a declaration" line " if(condition) { break; } "
Does anyone understand this error?
remove the \ from the last line
I mean change this line
 } while(0)                                                     \
by
 } while(0)
And remove all spaces after the \
you have some lines which contain spaces after the \ like:
while(1)                                  \    
      {                                         \           
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With