Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualSolid_Spy

Posted 11 February 2013 - 08:15 PM

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

#2Solid_Spy

Posted 11 February 2013 - 08:14 PM

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

#1Solid_Spy

Posted 11 February 2013 - 08:13 PM

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:\Users\Connor\documents\visual studio 2012\Projects\Project30\Debug\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:\Users\Connor\documents\visual studio 2012\Projects\Project30\Project30\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:\Users\Connor\documents\visual studio 2012\Projects\Project30\Project30\Effects11.lib(EffectLoad.obj)    Project30
 
Any help would be appreciated :)
 

PARTNERS