title: C2065 undeclared identifier
body: <p>I have got a problem but I don't know why.
  I'm fallowing <a href="http://www.directxtutorial.com/Lesson.aspx?lessonid=11-4-2" rel="nofollow">this</a> to learn DirectX.
  I used <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ee663275.aspx" rel="nofollow">this</a> to configure the solution.</p>
  
  <p>This is my code: </p>
  
  <p>Header:</p>
  
  <pre><code>#include &lt;d3d11.h&gt;
  #include &lt;d3dx11.h&gt;
  #include &lt;d3d10.h&gt;
  #include &lt;d3dx10.h&gt;
  #include &lt;dxgi.h&gt;
  #include &lt;Windows.h&gt;
  #include &lt;windowsx.h&gt;
  
  #pragma comment (lib, "d3d11.lib")
  #pragma comment (lib, "d3dx11.lib")
  #pragma comment (lib, "d3dx10.lib")
  
      class HelloWorld
      {
      private: 
          IDXGISwapChain* swapchain;             
          ID3D11Device* dev;                     
          ID3D11DeviceContext* devcon; 
  
          LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
  
      public:
          void InitD3D(HWND hWnd);    
          void CleanD3D(void);  
          int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd);
      };
  }
  </code></pre>
  
  <p>and cpp:</p>
  
  <pre><code>#include "HelloWorld.h"
  
  void InitD3D(HWND hWnd)
  {
      DXGI_SWAP_CHAIN_DESC scd;
  
      ZeroMemory(&amp;scd, sizeof(DXGI_SWAP_CHAIN_DESC));
  
      scd.BufferCount = 1;
      scd.BufferDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
      scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
      scd.OutputWindow = hWnd;
      scd.SampleDesc.Count = 4;
      scd.Windowed = TRUE;
  
      D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE,
          NULL, NULL, NULL, NULL, 
          D3D11_SDK_VERSION, &amp;scd, &amp;swapchain, &amp;dev, NULL, &amp;devcon);
  }
  
  void CleanD3D(void)
  {
      swapchain-&gt;Release();
      dev-&gt;Release();
      devcon-&gt;Release();
  }
  
  LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
  {
      switch(message)
      {
      case WM_DESTROY: 
          {
              PostQuitMessage(0);
              return 0;
          }break;
      }
  
      return DefWindowProc(hWnd, message, wParam, lParam);
  }
  
  int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
  {
      HWND hWnd;
      WNDCLASSEX wc;
  
      ZeroMemory(&amp;wc, sizeof(WNDCLASSEX));
  
      wc.cbSize = sizeof(WNDCLASSEX);
      wc.style = CS_HREDRAW | CS_VREDRAW;
      wc.lpfnWndProc = WindowProc;
      wc.hInstance = hInstance;
      wc.hCursor = LoadCursor(NULL, IDC_ARROW);
      wc.hbrBackground = (HBRUSH)COLOR_WINDOW;
      wc.lpszClassName = "WindowClass1";
  
      RegisterClassEx(&amp;wc);
  
      RECT wr = {0, 0, 400, 400};
      AdjustWindowRect(&amp;wr, WS_OVERLAPPEDWINDOW, FALSE);
  
      hWnd = CreateWindowEx(NULL,
          "WindowClass1",
          "First windowed program",
          WS_OVERLAPPEDWINDOW,
          300,
          300,
          wr.right - wr.left,
          wr.bottom - wr.top,
          NULL,
          NULL,
          hInstance,
          NULL);
  
      ShowWindow(hWnd, nCmdShow);
  
      MSG msg = {0};
  
      while(true)
      {
          if(PeekMessage(&amp;msg, NULL, 0, 0, PM_REMOVE))
          {
              TranslateMessage(&amp;msg);
              DispatchMessage(&amp;msg);
  
              if(msg.message == WM_QUIT)
              {
                  break;
              }
          }
          else
          {
  
          }
      }
  
      return msg.wParam;
  }
  </code></pre>
  
  <p>But during compilation I have got a C2065 error on : swapchain, dev and devcon.</p>
  
  <p>I have tried several thing but nothing worked.</p>
  
  <p>If somebody could help my, it will be appreciate !</p>
  
  <p>PuK</p>