Search code examples
objective-cxcodegccobjective-c++

XCode GCC-4.0 vs 4.2


I have just changed a compiler option from 4.0 to 4.2.

Now I get an error:

jump to case label crosses initialization of 'const char* selectorName'

It works fine in 4.0

Any ideas?


Solution

  • Just a guess - you declare variable (probably const char*) inside 1 of your switch-case statements - you should wrap that case in {} to fix that.

    // error
    case 1:
       const char* a = ... 
       break; 
    
    // OK
    case 1:{
       const char* a = ... 
    }
       break;