title: Cannot declare variable inside @interface or @protocol
body: <p>I have an iOS app built since the beginning with an error in it. Since the source was began constructed from the template, its appdelegate.h looks like:</p>
  
  <pre><code>@interface myAppDelegate : NSObject &lt;UIApplicationDelegate&gt; {
      UIWindow *window;
      myViewController *viewController;
  }
  
  BOOL       myBool;     // intended to be globally accessible
  NSString   *myString;  // intended to be globally accessible
  
  @end
  </code></pre>
  
  <p>I refer to <strong>myBool</strong> and <strong>*myString</strong> from many other .m source files, as to global variables.</p>
  
  <p>Below XCode 3.2.6, I can not remember getting any issues at compile time.</p>
  
  <p>At 3.2.6, warning appeared at compile pointing to these “global” variables in appdelegate.h, saying: “Cannot declare variable inside @interface or @protocol”. As there were no further problems with compilation or during app runtime, unfortunately I did not consider these warnings.</p>
  
  <p>Now, using XCode 4.2, I am unable to compile this source, because the former warnings turned into build errors. They refer and point to each of those lines in the different .m files where there is a reference to the “global variables”.</p>
  
  <p>Is there an easy way to correct this problem, considering that I still want to access these variables/references as global ones?</p>
  
  <p><strong>Additional question</strong>: while I am evaluating so far received answers (thanks for all of you), another question: any idea why no warning were given below XCode v3.2.6, and only warnings in 3.2.6 if this is a real error from my side? And why the code was still compiled and could be run without any problem?</p>