Unresolved external symbol for NvEncoderCuda::CopyToDeviceFrame

Making a DirectShow transform filter utilizing the latest nVidia Video Codec SDK (v11.1.5). When trying to compile, the linker complains about an unresolved external symbol for the CopyToDeviceFrame method inside the NvEncoderCuda class. I have looked at the library I’m linking to (NvEncoderLib.lib) and it has the CopyToDeviceFrame method in it. I generated the lib file by adding a library output to the AppEncodeCuda sample in the SDK:

add_library(NvEncoderLib STATIC ${NV_ENC_SOURCES})

In my filter code, this is the method to handle the encoding of the frames:

HRESULT CNVENCEncoder::OnReceive(IMediaSample *pSample)
{
    std::vector<std::vector<uint8_t>> vPacket;
    
    BYTE* pBuffer = NULL;
    if (pSample->GetPointer(&pBuffer) < 0)
        return S_FALSE;

    const NvEncInputFrame* encoderInputFrame = m_pEncoder->GetNextInputFrame();
    m_pEncoder->CopyToDeviceFrame(context, pBuffer, 0, (CUdeviceptr)encoderInputFrame->inputPtr,
        (int)encoderInputFrame->pitch,
        m_pEncoder->GetEncodeWidth(),
        m_pEncoder->GetEncodeHeight(),
        CU_MEMORYTYPE_HOST,
        encoderInputFrame->bufferFormat,
        encoderInputFrame->chromaOffsets,
        encoderInputFrame->numChromaPlanes);

    m_pEncoder->EncodeFrame(vPacket);

    return S_OK;
}

It is only the CopyToDeviceFrame method that is breaking the linker, I have several calls earlier that initialize the encoder, etc. that all link and compile without issue.

Am I missing something? Is there a different way to do this without CopyToDeviceFrame?

Thanks for the help in advance-

If it helps (though generic link errors never do):

Error LNK2019 unresolved external symbol "public: static void __stdcall NvEncoderCuda::CopyToDeviceFrame(struct CUctx_st *,void *,unsigned int,unsigned int,unsigned int,int,int,enum CUmemorytype_enum,enum _NV_ENC_BUFFER_FORMAT,unsigned int const * const,unsigned int,bool,struct CUstream_st *)" (?CopyToDeviceFrame@NvEncoderCuda@@SGXPAUCUctx_st@@PAXIIIHHW4CUmemorytype_enum@@W4_NV_ENC_BUFFER_FORMAT@@QBII_NPAUCUstream_st@@@Z) referenced in function "public: long __thiscall CNVENCEncoder::OnReceive(struct IMediaSample *)" (?OnReceive@CNVENCEncoder@@QAEJPAUIMediaSample@@@Z)	NVENCEncoder

nvencoderlib_dump.txt (11.5 MB)

Library looks good (dump attached), here is the lib output:

d:\Development\nVidia_Video_Codec_SDK_11.1.5\Lib\Win32>lib /list NvEncoderLib.lib
Microsoft (R) Library Manager Version 14.29.30143.0
Copyright (C) Microsoft Corporation.  All rights reserved.

AppEncode\AppEncCuda\CMakeFiles\NvEncoderLib.dir\__\__\NvCodec\NvEncoder\NvEncoder.cpp.obj
AppEncode\AppEncCuda\CMakeFiles\NvEncoderLib.dir\__\__\NvCodec\NvEncoder\NvEncoderCuda.cpp.obj
AppEncode\AppEncCuda\CMakeFiles\NvEncoderLib.dir\__\__\NvCodec\NvEncoder\NvEncoderOutputInVidMemCuda.cpp.obj

Never mind. I ended up just wrinting my own classes for everything in my CTransformFilter project and no more issues. So much for saving a little time with the samples…

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.