C2360 에러는 msdn에 다음과 같이 설명되어 있습니다.
프로그래밍 중 select case문에서 변수를 선언했을 때에 발생하는 오류에 대한 내용 이었습니다.
initialization of 'identifier' is skipped by 'case' label
The initialization of identifier can be skipped in a switch statement. You cannot jump past a declaration with an initializer unless the declaration is enclosed in a block. (Unless it is declared within a block, the variable is within scope until the end of the switch statement.)
The following sample generates C2360:
// C2360.cpp
int main() {
int x = 0;
switch ( x ) {
case 0 :
int i = 1;
{ int j = 1; }
case 1 : // C2360
int k = 1;
}
}
위와 같은 식으로 프로그래밍 하셨다면..C2360 에러를 만나실 수 있습니다.
다음과 같이 작성하면 에러를 제거하실 수 있습니다.
Possible resolution:
// C2360b.cpp
int main() {
int x = 0;
switch ( x ) {
case 0 :
{ int j = 1; int i = 1; }
case 1 :
int k = 1;
}
}
댓글 없음:
댓글 쓰기