title: Syntax error: identifier not found... But i have included it? C++
body: <p>I have a Game class -</p>
  
  <p><strong>Game.h</strong>:</p>
  
  <pre><code>#pragma once
  
  #include "D3DGraphics.h"
  #include "Mouse.h"
  #include "Screen.h"
  #include "Script.h"
  
  class Game
  {
  public:
      Game( HWND hWnd, const MouseServer &amp;mouseServer, const ScreenServer &amp;screenServer );
      void Go();
      void Config();
  
  private:    
      void ComposeFrame();
  
      D3DGraphics gfx;
      MouseClient mouse;
      ScreenClient screen;
  
      Script * scripts[ 1 ];
  };
  </code></pre>
  
  <p>I have a D3DGraphics class -</p>
  
  <p><strong>D3DGraphics.h</strong>:</p>
  
  <pre><code>#pragma once
  
  #include &lt;d3d9.h&gt;
  #include &lt;d3dx9.h&gt;
  
  #include "Screen.h"
  #include "Script.h"
  
  #define CUSTOMFVF (D3DFVF_XYZRHW | D3DFVF_DIFFUSE)
  
  struct CUSTOMVERTEX
  {
      FLOAT x, y, z, rhw;    // from the D3DFVF_XYZRHW flag
      DWORD color;    // from the D3DFVF_DIFFUSE flag
  };
  
  class D3DGraphics
  {
  public:
      D3DGraphics( HWND hWnd, ScreenClient screenClient );
      ~D3DGraphics();
  
      void Begin();
      void End();
      void Present();
  
      void CreateViewport();
      void DefineText( Script *script );
  
      LPDIRECT3D9 d3dObject;
      LPDIRECT3DDEVICE9 d3dDevice;
      D3DPRESENT_PARAMETERS presParams;
      HRESULT hr;
  
      float ResizeLockRatio( float width, float height, float scalingWidth );
      float GetGameOffset( float resizedImageHeight );
  
      void DrawRectangle( int x, int y, int width, int height, D3DCOLOR backgroundColor );
      void DrawActionBar();
      void RenderText( Script *script );
  private:
      LPDIRECT3DVERTEXBUFFER9 vBuffer;
      ScreenClient screen;
  };
  </code></pre>
  
  <p>Notice that the Game class has both </p>
  
  <pre><code>D3DGraphics gfx;
  Script * scripts[ 1 ];
  </code></pre>
  
  <p>In my Game.cpp I make a version of D3DGraphics and place it in gfx:</p>
  
  <p><strong>Game.cpp</strong>:</p>
  
  <pre><code>#include "Game.h"
  
  Game::Game( HWND hWnd, const MouseServer &amp;mouseServer, const ScreenServer &amp;screenServer )
      :   mouse( mouseServer ),
          screen( screenServer ),
          gfx( hWnd, screen )
  {
      //gfx.d3dDevice-&gt;SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE);
  
      std::string debugStringResult;
      std::stringstream debugString;
      debugString &lt;&lt; "Mouse X: " &lt;&lt; mouse.GetMouseX() &lt;&lt; ",\nMouse Y: " &lt;&lt; mouse.GetMouseY() &lt;&lt; ",\nLeft mouse down: " &lt;&lt; mouse.LeftMouseDown() &lt;&lt; ",\nRight mouse down: " &lt;&lt; mouse.RightMouseDown() &lt;&lt; ",\nScreen width: " &lt;&lt; screen.GetScreenWidth() &lt;&lt; ",\nScreen height: " &lt;&lt; screen.GetScreenHeight() &lt;&lt; "\nSystem resolution: " &lt;&lt; screen.GetWindowWidth() &lt;&lt; " x " &lt;&lt; screen.GetWindowHeight();
      debugStringResult = debugString.str();
          scripts[ 0 ] = new Script( gfx, "Arial", 0, 0, 255, 0, debugStringResult, 10, 10, ( screen.GetWindowWidth() - 10 ), ( screen.GetWindowHeight() - 10 ) );
  }
  </code></pre>
  
  <p>I have a  Script class - </p>
  
  <p><strong>Script.h</strong>:</p>
  
  <pre><code>#pragma once
  
  #include "D3DGraphics.h"
  #include &lt;sstream&gt;
  
  class Script
  {
  public: 
      Script( D3DGraphics gfx,
              LPCSTR font, 
              int alpha, int r, int g, int b, 
              std::string text, 
              float x, float y, float width, float height );
  
      LPCSTR font;
      int alpha, r, g, b;
      std::string text;
      float x, y, width, height;
      D3DCOLOR color;
      RECT rect;
      ID3DXFont *handle;
  private:
  };
  </code></pre>
  
  <p>My Script constructor looks like this:</p>
  
  <p><strong>Script.cpp</strong>:</p>
  
  <pre><code>#include "Script.h"
  
  Script::Script( D3DGraphics gfx,
                  LPCSTR font, 
                  int alpha, int r, int g, int b, 
                  std::string text, 
                  float x, float y, float width, float height )
  {
      gfx.DefineText( this );
  }
  </code></pre>
  
  <p>And so on. Now the error when I compile my application comes up as:</p>
  
  <pre><code>Error   1   error C2061: syntax error : identifier 'D3DGraphics'    c:\users\james\documents\visual studio 2012\projects\thegame\thegame\script.h   9   1   TheGame
  Error   8   error C2061: syntax error : identifier 'D3DGraphics'    c:\users\james\documents\visual studio 2012\projects\thegame\thegame\script.h   9   1   TheGame
  Error   9   error C2661: 'Script::Script' : no overloaded function takes 11 arguments   c:\users\james\documents\visual studio 2012\projects\thegame\thegame\game.cpp   14  1   TheGame
  Error   10  error C2061: syntax error : identifier 'Script' c:\users\james\documents\visual studio 2012\projects\thegame\thegame\d3dgraphics.h  28  1   TheGame
  Error   11  error C2061: syntax error : identifier 'Script' c:\users\james\documents\visual studio 2012\projects\thegame\thegame\d3dgraphics.h  40  1   TheGame
  Error   12  error C2660: 'D3DGraphics::DefineText' : function does not take 1 arguments c:\users\james\documents\visual studio 2012\projects\thegame\thegame\script.cpp 9   1   TheGame
  Error   13  error C2061: syntax error : identifier 'D3DGraphics'    c:\users\james\documents\visual studio 2012\projects\thegame\thegame\script.h   9   1   TheGame
  Error   16  error C2061: syntax error : identifier 'D3DGraphics'    c:\users\james\documents\visual studio 2012\projects\thegame\thegame\script.h   9   1   TheGame
  </code></pre>
  
  <p>Line 9 of Script.h is:</p>
  
  <pre><code>Script( D3DGraphics gfx,...
  </code></pre>
  
  <p>I honestly have no idea what on earth is happening? Does anyone have a clue, I've been poking at the code like a dead animal for the past 2 hours.</p>