Declaring and initializing a static int in a header
<p>If I have the following in a header file:</p>

<p>Foo.h</p>

<pre><code>Foo
{
public:
  static const int BAR = 1234;
  ...
};
</code></pre>

<p>Do I also need to define the variable in the .cpp, e.g.:</p>

<p>Foo.cpp</p>

<pre><code>const int Foo::BAR;
</code></pre>

<p>We have an issue where initializing a static in a header seems to work on MS compilers but with gcc on the Mac it seems to give linker errors.</p>
