title: Undefined reference to global variable
body: <p>I'm working with C, and the Quake 3 / ioquake engine. Note that this is not a game engine specific question, it's purely a C language query.</p>
  
  <p><code>g_entities</code> is a variable defined globally in the engine. There is also use of an <code>extern</code> statement for this variable.</p>
  
  <p>Numerous other <code>.c</code> files within the engine call this variable without problem, however when I do this from my code, I get an <code>undefined reference to g_entities</code> linker error on compile.</p>
  
  <p><strong>My code:</strong></p>
  
  <pre><code>// get entity information for this bot (e.g. health etc)
  gentity_t *entity;
  entity = &amp;g_entities[1];
  </code></pre>
  
  <p><strong>Error on make:</strong></p>
  
  <pre><code>/home/george/Desktop/ioquake/ioquake-latest/ioquake3/code/botlib/be_ai_char.c:1196: undefined reference to `g_entities'
  </code></pre>
  
  <p>I would appreciate any advice any C guru could spare that might point me to a solution. Thanks.</p>