Muokkaa

Jaa


Compiler Error C2181

illegal else without matching if

Each else must have a matching if.

The following sample generates C2181:

// C2181.cpp
int main() {
   int i = 0;
   else   // C2181
      i = 1;
}

Possible resolution:

// C2181b.cpp
int main() {
   int i = 0;
   if(i)
      i = 0;
   else
      i = 1;
}