I'm probably overlooking something simple, however compilation of the shader compilation call is claiming there is no instance of overloaded function, despite the code working in other projects.
//Globals
IDXGISwapChain *swapChain; //Pointer to the swapchain interface
ID3D11Device *dev; //Pointer to the Direct3D Device interface
ID3D11DeviceContext *devcon; //Pointer to the Direct3D Device context
ID3D11RenderTargetView *backBuffer;
//Shaders
ID3D11VertexShader* pVS;
ID3D11PixelShader* pPS;
void InitPipeline()
{
//Load and Compile Shaders
ID3D10Blob *VS;
ID3D10Blob *PS;
D3DX11CompileFromFile(L"shader.shader", 0, 0, "VShader", "vs_4_0", 0, 0, 0, &VS, 0, 0);
D3DX11CompileFromFile(L"shader.shader", 0, 0, "PShader", "ps_4_0", 0, 0, 0, &PS, 0, 0);
//encapsulate shaders into shader objects
dev->CreateVertexShader(VS->GetBufferPointer(), VS->GetBufferSize(), NULL, &pVS);
dev->CreatePixelShader(PS->GetBufferPointer(), PS->GetBufferSize(), NULL, &pPS);
//Set Shader Objects
devcon->VSSetShader(pVS, 0, 0);
devcon->PSSetShader(pPS, 0, 0);
}
The error is:
no instance of overloaded function "D3DX11CompileFromFileA" matches the argument list argument types are: (const wchar_t [14], int, int, const char [8], const char [7], int, int, int, ID3D10Blob **, int, int)
D3DX11CompileFromFileA
is an ANSI string method. You are attempting to pass a wide character constant into it as the first parameter (L"shader.shader"
). See this question for more details on the difference between ANSI and UNICODE functions in Windows APIs.You will either need to change your project settings, so that the CharacterSet property is UNICODE (see here for documentation), or you can pass in a UTF-8 string (and continue to use the ANSI method), by removing the
L
in front of the string constant.