I am getting an error of "jump to case label" and "cross initialization" while compiling a simple test program. I started a new window project then added the following 3 lines in the message handling area. (These are the only lines I added to the entire program.)
case WM_CREATE:
int n=1;
break;
When I complile I get "jump to case label" for each of the following "case" lines (2 in the standard windows new project)
If I change the middle line to:
int n; n=1;
everything works fine. ---- What's happening?
Here is the usual info:
Windows 98SE, Dev-C++ 4.9.9.1
Full compile log:
Compiler: Default compiler
Building Makefile: "C:\TupsPrograms\Temp\Makefile.win"
Executing make...
make.exe -f "C:\TupsPrograms\Temp\Makefile.win" all
g++.exe -c Temp1.cpp -o Temp1.o -I"C:/DEV-CPP/include/c++/3.3.1" -I"C:/DEV-CPP/include/c++/3.3.1/mingw32" -I"C:/DEV-CPP/include/c++/3.3.1/backward" -I"C:/DEV-CPP/lib/gcc-lib/mingw32/3.3.1/include" -I"C:/DEV-CPP/include" -g3 -O0
Temp1.cpp: In function `LRESULT WindowProcedure(HWND__*, unsigned int, unsigned
int, long int)':
Temp1.cpp:82: error: jump to case label
Temp1.cpp:79: error: crosses initialization of int n'
Temp1.cpp:85: error: jump to case label
Temp1.cpp:79: error: crosses initialization ofint n'
Execution terminated
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am getting an error of "jump to case label" and "cross initialization" while compiling a simple test program. I started a new window project then added the following 3 lines in the message handling area. (These are the only lines I added to the entire program.)
case WM_CREATE:
int n=1;
break;
When I complile I get "jump to case label" for each of the following "case" lines (2 in the standard windows new project)
If I change the middle line to:
int n; n=1;
everything works fine. ---- What's happening?
Here is the usual info:
Windows 98SE, Dev-C++ 4.9.9.1
Full compile log:
Compiler: Default compiler
Building Makefile: "C:\TupsPrograms\Temp\Makefile.win"
Executing make...
make.exe -f "C:\TupsPrograms\Temp\Makefile.win" all
g++.exe -c Temp1.cpp -o Temp1.o -I"C:/DEV-CPP/include/c++/3.3.1" -I"C:/DEV-CPP/include/c++/3.3.1/mingw32" -I"C:/DEV-CPP/include/c++/3.3.1/backward" -I"C:/DEV-CPP/lib/gcc-lib/mingw32/3.3.1/include" -I"C:/DEV-CPP/include" -g3 -O0
Temp1.cpp: In function `LRESULT WindowProcedure(HWND__*, unsigned int, unsigned
int, long int)':
Temp1.cpp:82: error: jump to case label
Temp1.cpp:79: error: crosses initialization of
int n' Temp1.cpp:85: error: jump to case label Temp1.cpp:79: error: crosses initialization of
int n'Execution terminated
it won't like having a variable declaration in a case statement unless you use brackets
case WM_CREATE:
{
int n=1;
}
break;
b_a