Declaring an array whose size is declared as extern const
<p>I have a problem initializing an array whose size is defined as extern const.
I have always followed the rule that global variables should be declared as extern in the header files and their corresponding definitions should be in one of the implementation files in order to avoid variable redeclaration errors. This approach worked fine till I had to initialize an array with whose size is defined as an extern const. 
I get an error that a constant expression is expected. However, if I try to assign a value to the const variable the compiler correctly complains that a value cannot be assigned to a constant variable. This actually proves that the compiler does see the variable as a constant. Why then is an error reported when I try to declare an array of the same size?</p>

<p>Is there any way to avoid this without using #define? I would also like to know the reason for this error.</p>

<p>Package.h:</p>

<pre><code>#ifndef PACKAGE_H
#define PACKAGE_H

extern const int SIZE;

#endif
</code></pre>

<p>Package.cpp:</p>

<pre><code>#include "Package.h"

const int SIZE = 10;
</code></pre>

<p>Foo.cpp:</p>

<pre><code>#include "Package.h"

int main()
{
    // SIZE = 5; // error - cannot assign value to a constant variable
    // int Array[SIZE]; // error - constant expression expected
    return 0;
}
</code></pre>
