views:

88

answers:

2

I am trying to call a direct X funciton but I get the following error

error LNK2001: unresolved external symbol _D3DX10CreateTextureFromFileW@24

I understand that possibly there maybe a linker issue. But I am not sure where. I inluded both d3dx10.h and the d3d10.h. I also included the d3d10.lib file. Plus, the intellisense picks up on the method as well. below is my code. The method is D3DX10CreateTextureFromFile

bool MyGame::InitDirect3D()
{
    if(!DX3dApp::InitDirect3D())
    {
        return false;
    }

    ID3D10Resource* pD3D10Resource = NULL;
    HRESULT hr = D3DX10CreateTextureFromFile(mpD3DDevice,
                                                L"C:\\delete.jpg",
                                                NULL,
                                                NULL,
                                                &pD3D10Resource,
                                                NULL);
    if(FAILED(hr))
    {
        return false;
    }

    return true;
}
+3  A: 

Is the appropriate DirectX library (or libraries) configured inthe project or makefile (or whatever build system is being used)?

For this particular function , it's D3DX10.lib.

Michael Burr
O, I forgot there were actually 2 lib files.
numerical25
+1  A: 

You need D3DX10.lib: http://msdn.microsoft.com/en-us/library/bb172671%28VS.85%29.aspx

Alex Farber