title: C++ Extern Class Declaration
body: <p>I wrote a little test program to show here. Here is the source code.</p>
  <p>main.cpp:</p>
  <pre><code>#include &quot;core.h&quot;
  
  Core core;
  
  int main()
  {
    core.coreFunction();
  }
  </code></pre>
  <p>core.h:</p>
  <pre><code>#ifndef CORE_H__
  #define CORE_H__
  
  #include &quot;definitions.h&quot;
  #include &quot;window.h&quot;
  
  class Core
  {
  public:
    Window window;
    void coreFunction()
    {
      window.windowFunction();
    }
  };
  extern Core core;
  
  #endif
  </code></pre>
  <p>definitions.h</p>
  <pre><code>#ifndef DEFINITIONS_H__
  #define DEFINITIONS_H__
  
  class Core;
  class Window;
  
  #endif
  </code></pre>
  <p>window.h</p>
  <pre><code>#ifndef WINDOW_H__
  #define WINDOW_H__
  
  class Window
  {
  public:
  
     void windowFunction()
     {
       core.coreFunction();
     }
  };
  
  #endif
  </code></pre>
  <p>With this test program I get the following error: <code>window.h(10): error C2065: 'core' : undeclared identifier</code>. I hope this clarifies my problem a little bit. Please ignore that these functions make no sense its just for showing what I did because my original code is way too long to post here.</p>