title: Weird Error C2146 and C4430 in d3d11shader.h in VS2012
body: <p>So I was following instructions on a book to create a d3d object. However, when I tried to compile the codes, it gives me some weird error in d3d11shader.h.</p>
  
  <p>Inside the d3dshader.h,</p>
  
  <pre><code>#include "d3dcommon.h" 
  //other stuff
  typedef struct _D3D11_SIGNATURE_PARAMETER_DESC
  {
      LPCSTR                      SemanticName;   
      UINT                        SemanticIndex;  
      UINT                        Register;       
      D3D_NAME                    SystemValueType;
      D3D_REGISTER_COMPONENT_TYPE ComponentType;  
      BYTE                        Mask;                      
      BYTE                        ReadWriteMask;  
      UINT                        Stream;        
      D3D_MIN_PRECISION           MinPrecision;  //Errors here
  } D3D11_SIGNATURE_PARAMETER_DESC;
  </code></pre>
  
  <p>For details:</p>
  
  <pre><code>(1) Error   29  error C2146: syntax error : missing ';' before identifier 'MinPrecision'    c:\program files (x86)\windows kits\8.0\include\um\d3d11shader.h    54
  (2) Error   30  error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   c:\program files (x86)\windows kits\8.0\include\um\d3d11shader.h    54
  </code></pre>
  
  <p>It's weird cause both d3dcommon.h and d3d11shader.h files are defined in Windows SDK and DirectX SDK so I couldn't change anything in them. Can anyone tell me how to fix it? Any input is appreciated here.</p>
  
  <p>Here is the codes in my Source.cpp which are directly copied from the book 3D Game Programming with DirectX11 by Frank Luna.</p>
  
  <pre><code>#include "d3dApp.h"//This header file is provided by the book
  
  
  class InitDirect3DApp : public D3DApp
  {
  public:
      InitDirect3DApp(HINSTANCE hInstance);
      ~InitDirect3DApp();
  
      bool Init();
      void OnResize();
      void UpdateScene(float dt);
      void DrawScene(); 
  };
  
  int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevInstance,
                 PSTR cmdLine, int showCmd)
  {
  // Enable run-time memory check for debug builds.
  #if defined(DEBUG) | defined(_DEBUG)
      _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
  #endif
  
      InitDirect3DApp theApp(hInstance);
  
      if( !theApp.Init() )
          return 0;
  
      return theApp.Run();
  }
  
   Init Direct3DApp::InitDirect3DApp(HINSTANCE hInstance)
    : D3DApp(hInstance) 
  {
   }
  
   InitDirect3DApp::~InitDirect3DApp()
  {
  }
  
   bool InitDirect3DApp::Init()
  {
      if(!D3DApp::Init())
          return false;
  
      return true;
  }
  
   void InitDirect3DApp::OnResize()
  {
      D3DApp::OnResize();
  }
  
  void InitDirect3DApp::UpdateScene(float dt)
  {
  
  }
  
  void InitDirect3DApp::DrawScene()
  {
      assert(md3dImmediateContext);
      assert(mSwapChain);
  
      md3dImmediateContext-&gt;ClearRenderTargetView(mRenderTargetView,     reinterpret_cast&lt;const float*&gt;(&amp;Colors::Blue));
      md3dImmediateContext-&gt;ClearDepthStencilView(mDepthStencilView, D3D11_CLEAR_DEPTH|D3D11_CLEAR_STENCIL, 1.0f, 0);
  
      HR(mSwapChain-&gt;Present(0, 0));
  }
  </code></pre>
  
  <p>And another weird thing I've noticed is that sometimes when I go to the definition of D3D_MIN_PRECISION and it directs me to d3dcommon.h, the codes in d3dcommon.h are not highlighted at all. Visual Studio does highlightings for all other files automatically but not for this one..  So I just assume it doesn't recognize the codes in this specific header file some time.. </p>
  
  <p>Also, as I tried to compile the codes just now, there's another error popping out in addition to the previous two: </p>
  
  <pre><code>   31   IntelliSense: identifier "D3D_MIN_PRECISION" is undefined   c:\Program Files (x86)\Windows Kits\8.0\Include\um\d3d11shader.h    54
  </code></pre>
  
  <p>Just for your information, I'm using vs2012 on a windows 8.1 machine. Thanks a lot!</p>