DirectShow 链接错误 CPosPassThru 解决方法

    技术2024-10-15  60

    今天使用VS2008编译某Directshow工程,报以下错误

    error LNK2001: unresolved external symbol "public: __thiscall CPosPassThru::CPosPassThru(char const *,struct IUnknown *,long *,struct IPin *)" (??0CPosPassThru@@QAE@PBDPAUIUnknown@@PAJPAUIPin@@@Z)

    尝试了各种方法

    首先,directshow依赖的include和lib一定要配置正确:

    假设你的directshow库的根目录在$(dxRoot):

    VC的include path中要加上

    $(dxRoot)/Include

    $(dxRoot)/Samples/C++/DirectShow/BaseClasses

    VC的lib path中要加上

    $(dxRoot)/Lib

    $(dxRoot)/Samples/C++/DirectShow/BaseClasses/Debug_Unicode

    对于工程Link依赖的库一般要加上:strmbasd.lib quartz.lib winmm.lib msvcrtd.lib

    但是上述各项都正确配置都是正确的,仍然会有上述的链接错误:

    最终发现是字符集的问题,directshow工程要求要使用unicode字符集,我的工程的属性中字符集设置的是Not Set,默认为MutiByte了。

    改为Unicode之后,不再报这里链接错误了。至此问题解决,希望能够对遇上同样问题的同学有所帮助。

    最新回复(0)