wicky
wicky

Reputation: 384

WICConvertBitmapSource() gives link error

I was trying to encode an image using WIC. and i made simple dll (to encode/decode) and reffered it from another aplication.

I added my_bitmap_converter() to do a convertion intended to use WICConvertBitmapSource() but it gives me a link error. here is my work

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;
}

how can i get rid of this error

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
     );

Upvotes: 2

Views: 827

Answers (1)

mhs
mhs

Reputation: 1042

if you referred here, you may realize that "Link library name is "windowscodecs.lib" instead of "wincodec.lib" in Windows SDK 7.0 "

maybe you are using SDK 7.0 or later. if it is, try adding windowscodecs.lib as an additional dependencies.

Upvotes: 3

Related Questions