Pergunta

I'm writing a basic program using direct3d and DXUT.

I am creating a direct3d device manually with D3D11CreateDeviceAndSwapChain() and passing it to DXUT using the DXUTSetD3D11Device() function which, according to the documentation should be correct.

What confuses me is that I get an LNK2019: unresolved external symbol error when calling DXUTSetD3D11Device(). I can call other DXUT functions such as DXUTCreateWindow() just fine, also I have built DXUT myself and have linked to it properly.

When I look in DXUT.h I can find the declaration of DXUTSetD3D11Device() but when I look in DXUT.cpp I can't find any reference to this function, so I think this might be why I'm getting this linker error.

This seems to be the same problem as mine.

I'll leave the relevant pieces of code here, just in case:

bool DXUTEngine::Initialise()
{
    HR(DXUTCreateWindow(m_appname));

    if(!m_pDirect3D->Initialise(DXUTGetHWND(), m_width, m_height))
    {
        OutputDebugString(L"\n\n Failed to initialise Direct3D\n\n");
        return false;
    }

    HR(DXUTSetD3D11Device(m_pDirect3D->GetDevice(), m_pDirect3D->GetSwapChain()));

    return true;
}

Here's where I create the device:

result = D3D11CreateDeviceAndSwapChain(NULL, driverType, NULL, 0, &featureLevel, 1,
D3D11_SDK_VERSION, &swapChainDesc, &m_pSwapChain, &m_pDevice, NULL, &m_pContext);

At the moment I either think I'm doing something very wrong or that this function just doesn't exist. I'd really appreciate any help.

Thanks in advance.

Foi útil?

Solução

From the link you post which point to MSDN forum, the DXUT11 framework was delivered in source code, so there is no lib files. so the error was not about any link errors.

Another important thing is: function DXUTSetD3D11Device has no implementation in DXUT framework. if you want to use it, you should implement it yourself.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top