c++visual-studiovideodirectshowmpeg-2

Undefined symbol (CLSID_CMPEG2EncoderVideoDS)


I cannot compile my project, that uses MPEG2 DirectShow video encoder. I've included Wmcodecdsp.h, but when I compile project, Visual C++ gives undefined symbol error on CLSID_CMPEG2EncoderVideoDS. I've tried to add to project msmpeg2enc.dll, but linker can't link it doesn't have export table.

The error I get is about this:

CaptureGraph.obj : error LNK2001: undefined external symbol "CLSID_CMPEG2EncoderVideoDS


Solution

  • Linker error like this means you need to link a missing .LIB

    A search on Windows SDK \lib directory gets you wmcodecdspuuid.lib. Hence...

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

    ... some where on the source code (I prefer below #includes) will do the trick.