1

I had the following structure:

#if COND
  ...
#endif
#elif COND2
  ...
#else
  ...
#endif

I have to replace elif with two statements: else and if:

#if COND
  ...
#endif
#else
  #if COND2
     ...
  #endif
#else     // error: #else after #else
  ...
#endif

What's wrong?

p.s. No I see what's wrong but how to write it without errors?

Brian Tompsett - 汤莱恩
  • 5,438
  • 68
  • 55
  • 126
Max Frai
  • 57,874
  • 75
  • 193
  • 301

1 Answers1

2

You can't have two #else statements in the same #if.

The correct version would be:

#if COND
  ...
#else
  #if COND2
     ...
  #else
     ...
  #endif
#endif
Luchian Grigore
  • 245,575
  • 61
  • 446
  • 609