Error using Effects in Directx 11.0

Started by
0 comments, last by Lucky_Alex 11 years ago

Hello, I've been trying to get an effect file to load in my directx game, however, i seem to get some strange errors. I followed the tutorial from a book I got, but it doesn't seem to work. It appears that I get the error every time i reach the CreateShaderFromMemory() function. Here's the code for my .cpp:


void InitPipeline()
{
    // load and compile the two shaders


    ID3D10Blob *compiledShader = 0;
    ID3D10Blob *errorMessage = 0;


    HRESULT hr;


    hr = D3DX11CompileFromFile("shader.txt", 0, 0, 0, "fx_5_0", D3D10_SHADER_DEBUG | D3D10_SHADER_SKIP_OPTIMIZATION, 0, 0, &compiledShader, &errorMessage, 0);


    if(FAILED(hr))
    {
        MessageBox(0, "shader compiler error", "ERROR", MB_OK);
    }


    errorMessage->Release();


    hr = D3DX11CreateEffectFromMemory(compiledShader->GetBufferPointer(), compiledShader->GetBufferSize(), 0, dev, &normalShader);
 

And here is my shader file:


struct vertexIn
{
    float3 position : POSITION;
    float4 color    : COLOR;
};


struct vertexOut
{
    float4 position : SV_POSITION;
    float4 color    : COLOR;
};


vertexOut VS(vertexIn vIn)
{
    vertexOut vOut;
    vOut.position = float4 (vIn.position, 1.0f);
    vOut.color = vIn.color;


    return vOut;
}


float4 PS(vertexOut pixelinsert) : SV_Target
{
    return pixelinsert.color;
}


technique11 t0
{
    pass p0
    {
        SetVertexShader(CompileShader(vs_5_0, VS()));
        SetPixelShader(CompileShader(ps_5_0, PS()));
    }
}
 

Here are the errors I am getting:

Error 3 error LNK1120: 2 unresolved externals C:\..Project30.exe 1 1 Project30
Error 2 error LNK2019: unresolved external symbol _D3DGetInputSignatureBlob@12 referenced in function "protected: long __thiscall D3DX11Effects::CEffectLoader::BuildShaderBlock(struct D3DX11Effects::SShaderBlock *)" (?BuildShaderBlock@CEffectLoader@D3DX11Effects@@IAEJPAUSShaderBlock@2@@Z) C:\...Effects11.lib(EffectLoad.obj) Project30
Error 1 error LNK2019: unresolved external symbol _D3DReflect@16 referenced in function "protected: long __thiscall D3DX11Effects::CEffectLoader::BuildShaderBlock(struct D3DX11Effects::SShaderBlock *)" (?BuildShaderBlock@CEffectLoader@D3DX11Effects@@IAEJPAUSShaderBlock@2@@Z) C:\...Effects11.lib(EffectLoad.obj) Project30
Any help would be appreciated smile.png

View my game dev blog here!

Advertisement

In your project properties under Linker > Input > Additional Dependencies is d3dcompiler.lib specified in this list? If not, try adding it. I had the same issue and it's because those methods are defined in d3dcompiler.lib and I was missing it in my Linker dependencies.

This topic is closed to new replies.

Advertisement