LNK2001: IID_ID3D11ShaderReflection
19:24 17 Apr 2026

I have been attempting to resolve this issue: Error LNK2001 unresolved external symbol IID_ID3D11ShaderReflection DirectX11 C:\<..>\DX11ShaderReflection.obj 1 for quite some time now within the cpp file:

#include "DX11ShaderReflection.hpp"
#include 
#include 
#include 

using namespace Shaders;
using namespace Shaders::DX11;

void DX11ShaderReflection::ExtractInputLayout(
    ID3D11ShaderReflection* refl,
    ShaderReflectionData& outData
)
{
    D3D11_SHADER_DESC shaderDesc;
    refl->GetDesc(&shaderDesc);

    for (UINT i = 0; i < shaderDesc.InputParameters; i++)
    {
        D3D11_SIGNATURE_PARAMETER_DESC paramDesc;
        refl->GetInputParameterDesc(i, ¶mDesc);

        InputElement elem;
        elem.semanticName = paramDesc.SemanticName;
        elem.semanticIndex = paramDesc.SemanticIndex;
        elem.offset = D3D11_APPEND_ALIGNED_ELEMENT;

        // Map DXGI_FORMAT based on component mask
        if (paramDesc.Mask == 1)
            elem.format = DXGI_FORMAT_R32_FLOAT;
        else if (paramDesc.Mask <= 3)
            elem.format = DXGI_FORMAT_R32G32_FLOAT;
        else if (paramDesc.Mask <= 7)
            elem.format = DXGI_FORMAT_R32G32B32_FLOAT;
        else
            elem.format = DXGI_FORMAT_R32G32B32A32_FLOAT;

        outData.inputs.push_back(elem);
    }
}

void DX11ShaderReflection::ExtractConstantBuffers(
    ID3D11ShaderReflection* refl,
    ShaderReflectionData& outData
)
{
    D3D11_SHADER_DESC shaderDesc;
    refl->GetDesc(&shaderDesc);

    for (UINT i = 0; i < shaderDesc.ConstantBuffers; i++)
    {
        ID3D11ShaderReflectionConstantBuffer* cb = refl->GetConstantBufferByIndex(i);

        D3D11_SHADER_BUFFER_DESC cbDesc;
        cb->GetDesc(&cbDesc);

        ConstantBufferDesc out;
        out.name = cbDesc.Name;
        out.size = cbDesc.Size;
        out.bindPoint = i;

        outData.cbuffers.push_back(out);
    }
}

void DX11ShaderReflection::ExtractResources(
    ID3D11ShaderReflection* refl,
    ShaderReflectionData& outData
)
{
    D3D11_SHADER_DESC shaderDesc;
    refl->GetDesc(&shaderDesc);

    for (UINT i = 0; i < shaderDesc.BoundResources; i++)
    {
        D3D11_SHADER_INPUT_BIND_DESC bindDesc;
        refl->GetResourceBindingDesc(i, &bindDesc);

        ResourceBinding out;
        out.name = bindDesc.Name;
        out.bindPoint = bindDesc.BindPoint;
        out.type = bindDesc.Type;

        outData.resources.push_back(out);
    }
}

bool DX11ShaderReflection::Reflect(
    const Bytecode& bytecode,
    ShaderReflectionData& outData
)
{
    ID3D11ShaderReflection* refl = nullptr;

    HRESULT hr = D3DReflect(
        bytecode.data.data(),
        bytecode.data.size(),
        IID_ID3D11ShaderReflection,
        (void**)&refl
    );

    if (FAILED(hr) || !refl)
        return false;

    ExtractInputLayout(refl, outData);
    ExtractConstantBuffers(refl, outData);
    ExtractResources(refl, outData);

    refl->Release();
    return true;
}

The header is:

#pragma once

#pragma comment(lib, "d3dcompiler.lib")

#include "Engine/Shaders/Common/ShaderReflection.hpp"
#include 


namespace Shaders
{
    namespace DX11
    {
        class DX11ShaderReflection : public ShaderReflection
        {
        private:
            void ExtractInputLayout(ID3D11ShaderReflection* refl, ShaderReflectionData& outData);
            void ExtractConstantBuffers(ID3D11ShaderReflection* refl, ShaderReflectionData& outData);
            void ExtractResources(ID3D11ShaderReflection* refl, ShaderReflectionData& outData);

        public:
            DX11ShaderReflection() = default;
            ~DX11ShaderReflection() override = default;

            bool Reflect(
                const Bytecode& bytecode,
                ShaderReflectionData& outData
            ) override;
        };
    }
}

Yes, it's pretty apparent this is code generated by AI (Copilot in this case) I was using it to test an idea within a shader program I was working on... I am using VS2022 if that helps in any way...

directx-11