I have been struggling with some compilers errors since yesterday, trying to compile a DirectX11 project. Everything was working well until i created and defined an object to render. I added, for this, a shader (type effect).
The compiler told me that " "fxc.exe" exited with code 1". To solve this, i followed this answer : DirectX compilation error: error MSB6006: "fxc.exe" exited with code 1
Hence, i defined my HLSL compiler's shader model as :
Shader Model 5.0 (/5_0)
But after this, i still get some errors :
1>c:\program files (x86)\windows kits\8.1\include\um\d3d11shader.h(68): error C3646: 'MinPrecision': unknown override specifier
1>c:\program files (x86)\windows kits\8.1\include\um\d3d11shader.h(68): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\8.1\include\um\d3d11shader.h(235): error C3646: 'InterpolationMode': unknown override specifier
1>c:\program files (x86)\windows kits\8.1\include\um\d3d11shader.h(235): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\8.1\include\shared\dxgi1_2.h(1271): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\8.1\include\shared\dxgi1_2.h(1271): error C2143: syntax error: missing ',' before '*'
1>c:\program files (x86)\windows kits\8.1\include\shared\dxgi1_2.h(1275): error C2061: syntax error: identifier 'DXGI_RGBA'
For the three last errors, i had them before but fixed them following the step 5-a of this MSDN page : https://msdn.microsoft.com/en-us/library/windows/desktop/ee663275(v=vs.85).aspx But now these errors are back and i do not understand why. I did check the project properties again but the errors are still back.
I think these are some compiler errors, and i tried to fix it by following the step 6 of the above link but it did not work.
I'm using Visual Studio 2015 by the way.
Could anyone help me please ? I've really been searching for answers and trying to fix it but nothing seems to work for now. Thank you.
You are most likely mixing the legacy DirectX SDK and the Windows 8.1 SDK incorrectly. D3D_MIN_PRECISION
is missing a definition which is defined in the Windows 8.1 SDK version of d3dcommon.h
but not in the legacy DirectX SDK version.
Make sure your include/libs paths have the Windows 8.1 SDK listed first.
Make sure you are explicitly including <d3d11.h>
before you include <d3dx11.h>
to make sure you pick up the right version.
You might also want to explicitly include <d3dcommon.h>
first as well.
Ideally you'd just not use the legacy DirectX SDK at all in your project. See Living without D3DX and The Zombie DirectX SDK.
Of course all this applies to your C++ code. The headers d3d11shader.h
and dxgi1_2.h
can't be included into HLSL shader code.