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,753
  • 72
  • 57
  • 129
Max Frai
  • 61,946
  • 78
  • 197
  • 306

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
  • 253,575
  • 64
  • 457
  • 625