WICConvertBitmapSource() 给出 link 错误

WICConvertBitmapSource() gives link error

我正在尝试使用 WIC 对图像进行编码。 我制作了简单的 dll(到 encode/decode)并从另一个应用程序中引用了它。

我添加了 my_bitmap_converter() 来进行转换以使用 WICConvertBitmapSource(),但它给了我一个 link 错误。这是我的作品

int my_bitmap_converter
(
    REFWICPixelFormatGUID dstPixelFormt, 
    IWICBitmapSource* piBitmapSource, 
    IWICBitmapSource** ppiBitmapDst
)
{
    IWICBitmapSource* piScr = piBitmapSource;
    IWICBitmapSource** ppiDst = ppiBitmapDst;

    hr = WICConvertBitmapSource
        (
        dstPixelFormt,//GUID_WICPixelFormat128bppPRGBAFloat, 
        piScr,
        ppiDst
        );
    if (SUCCEEDED(hr))
    {
        piScr->Release();
        return 0;
    }
    return -1;
}

我怎样才能摆脱这个错误

Error 1 error LNK2019: unresolved external symbol _WICConvertBitmapSource@12 referenced in function "int __cdecl my_bitmap_converter(struct _GUID const &,struct IWICBitmapSource *,struct IWICBitmapSource * *)" (?my_bitmap_converter@@YAHABU_GUID@@PAUIWICBitmapSource@@PAPAU2@@Z)

---wincodec.h---

HRESULT WINAPI WICConvertBitmapSource(
     _In_ REFWICPixelFormatGUID dstFormat, // Destination pixel format
     _In_reads_(1) IWICBitmapSource  *pISrc,    // Source bitmap
     _Outptr_result_buffer_(1) IWICBitmapSource **ppIDst   // Destination bitmap, a copy or addrefed source
     );

如果您引用了 here,您可能会发现 "Link library name is "windowscodecs.lib" 而不是 Windows SDK 7.0 中的 "wincodec.lib""

可能您使用的是 SDK 7.0 或更高版本。如果是,请尝试添加 windowscodecs.lib 作为附加依赖项。