I have some code witch plays some sounds in a switch function but I need to find some way to get rid of the sounds and the variables holding the sounds from the memory. Her is the error I get:
“Case bypasses initializations of local variable”
I have already tried with:
But non of the are working
and by the way I am using Borland Builder 5 if it is for some help…
Will be thankfull for some help.
- GAmeZ asked 15 years ago
Yes it is a compiler error but it occur because of the fact that the compiler
(for some stupid reason) cant handle sound variables who are declared inside a switch.
It says it is a local variable (In the error)
The sound code are working joust fine in the rest of the program,
but not in my stupid switch.
Here is the whole error. I hope it can be to some help.
E2126 Case bypasses initialization of a local variable Compiler error
In C++ it is illegal to bypass the initialization of a local variable.
This error indicates a case label that can transfer control past this local variable.
I guess you did something like:
int j = 10;
now the line with int j = 10 throws the error you described. It means that another case statement is bypassing the initialization of j, which is not allowed in c++.
modify the code like this:
j = 10;
Please login first to submit.