Compiler Error C2046
illegal case
The keyword case
can appear only in a switch
statement.
The following sample generates C2046:
// C2046.cpp
int main() {
case 0: // C2046
}
Possible resolution:
// C2046b.cpp
int main() {
int i = 0;
switch(i) {
case 0:
break;
default:
break;
}
}
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for