我可能忽略了一些简单的东西,但是着色器编译调用的编译声称没有重载函数的实例,尽管该代码在其他项目中也有效。//GlobalsIDXGISwapChain *swapChain; //Pointer to the swapchain interfaceID3D11Device *dev; //Pointer to the Direct3D Device interfaceID3D11DeviceContext *devcon; //Pointer to the Direct3D Device contextID3D11RenderTargetView *backBuffer;//ShadersID3D11VertexShader* pVS;ID3D11PixelShader* pPS;void InitPipeline(){//Load and Compile ShadersID3D10Blob *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 objectsdev->CreateVertexShader(VS->GetBufferPointer(), VS->GetBufferSize(), NULL, &pVS);dev->CreatePixelShader(PS->GetBufferPointer(), PS->GetBufferSize(), NULL, &pPS);//Set Shader Objectsdevcon->VSSetShader(pVS, 0, 0);devcon->PSSetShader(pPS, 0, 0);}错误是: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是ANSI字符串方法。您试图将宽字符常量作为第一个参数(L"shader.shader")传递给它。有关Windows API中ANSI和UNICODE函数之间的区别的更多详细信息,请参见此question。您将需要更改项目设置,以使CharacterSet属性为UNICODE(有关文档,请参见here),或者可以通过删除前面的字符串常量。关于c++ - D3DX11CompileFromFile无效参数C++,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/30757702/
10-13 08:41