title: Eclipse/GCC: Undefined Reference to Extern Variable
body: <p>sorry if this is a repeated question, but I've been searching around for a couple of hours, and I'm getting conflicting answers... and what's worse, none of them are working.</p>
  
  <p>It's a simple matter. I have many source files, and I have some common parameters that I want to be in a single file, say "Parameters.h". I want to set these parameters (once) at runtime, by passing them as arguments to the program. </p>
  
  <p>PS: I know that a better way of doing it is to pass everything as arguments to functions, but it's a chunky piece of code and I need to get a result soon without making too many changes.</p>
  
  <p>Here is a minimal working example:</p>
  
  <p><strong>Parameters.h</strong></p>
  
  <pre><code>#ifndef PARAMETERS_H_
  #define PARAMETERS_H_
  
  extern int Alpha;
  
  #endif
  </code></pre>
  
  <p><strong>main.cpp</strong></p>
  
  <pre><code>#include &lt;iostream&gt;
  #include "Parameters.h"
  
  int main(int argc, char * argv[])
  {
      const int Alpha = 12.0;
  }
  </code></pre>
  
  <p><strong>Functions.cpp</strong></p>
  
  <pre><code>#include "Parameters.h"
  
  double Foo(const double&amp; x)
  {
      return Alpha*x;
  }
  </code></pre>
  
  <p>When I compile with</p>
  
  <pre><code>gcc main.cpp Functions.cpp
  </code></pre>
  
  <p>I get the error "Functions.cpp:(.text+0xa): undefined reference to `Alpha'".</p>