Compiler Error C2048
more than one default
A switch
statement contains multiple default
labels. Delete one of the default
labels to resolve the error.
The following sample generates C2048:
// C2048.cpp
int main() {
int a = 1;
switch (a) {
case 1:
a = 0;
default:
a = 2;
default: // C2048
a = 3;
}
}
Possible resolution:
// C2048b.cpp
int main() {
int a = 1;
switch (a) {
case 1:
a = 0;
default:
a = 2;
}
}
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