title: Invalid use of non-static data memeber
body: <p>I have the following code in A.h:</p>
  
  <pre><code>class A
  {
  public:
      ...
  private:
      ...
      const int X = 1;
      float Y[X];
      ...
  };
  </code></pre>
  
  <p>This compiles fine if only header A.h is included in the project. But if I include A.h in let's say A.cpp it gives me strange errors as follows:</p>
  
  <blockquote>
    <p>... warning: non-static data member initializers only available with
    -std=c++11 or -std=gnu++11 [enabled by default]</p>
    
    <p>... error: invalid use of non-static data member 'A::X' </p>
    
    <p>... error: from this location</p>
  </blockquote>
  
  <p>Even when I change <code>const int X = 1;</code> (though I need it as a constant parameter), nothing changes.</p>
  
  <p>p.s. If it makes sense I am using Qt 5.1</p>
  
  <p>p.s.s. Actually making it <code>static</code> fixes the error. But why <em>I have to</em> do that?</p>