WinCE DirectShow 链接错误

第一步

最简单的错误。 这个错误类似于如下的error messsage:

1>cameraEmpty.obj : error LNK2001: unresolved external symbol IID_IVideoWindow
1>cameraEmpty.obj : error LNK2001: unresolved external symbol PIN_CATEGORY_PREVIEW
1>cameraEmpty.obj : error LNK2001: unresolved external symbol MEDIATYPE_Video
1>cameraEmpty.obj : error LNK2001: unresolved external symbol CLSID_VideoCapture
1>cameraEmpty.obj : error LNK2001: unresolved external symbol CLSID_FilterGraph
1>cameraEmpty.obj : error LNK2001: unresolved external symbol CLSID_CaptureGraphBuilder

这种样式的错误的原因就是你没有把那些directx常用的那些lib引入。解决方案就是在stdafx.h里面加入这段代码:

view plaincopy to clipboardprint?
#pragma comment(lib, "atlosapis.lib")   
#pragma comment(lib, "strmbase.lib")   
#pragma comment(lib, "Strmiids.lib")   
#pragma comment(lib, "dmoguids.lib") 
#pragma comment(lib, "atlosapis.lib")
#pragma comment(lib, "strmbase.lib")
#pragma comment(lib, "Strmiids.lib")
#pragma comment(lib, "dmoguids.lib")

第二步

很多时候把这些库引入了还是有其他的连接错误, 形如:

1>cameraEmpty.obj : error LNK2019: unresolved external symbol "public: __cdecl CTransInPlaceFilter::CTransInPlaceFilter(wchar_t *,struct IUnknown *,struct _GUID const &,long *)" (??0CTransInPlaceFilter@@QAA@PA_WPAUIUnknown@@ABU_GUID@@PAJ@Z) referenced in function "public: __cdecl CRotateFilter::CRotateFilter(wchar_t *,struct IUnknown *,long *)" (??0CRotateFilter@@QAA@PA_WPAUIUnknown@@PAJ@Z)
1>cameraEmpty.obj : error LNK2001: unresolved external symbol "public: virtual long __cdecl CTransformFilter::FindPin(wchar_t const *,struct IPin * *)" (
?FindPin@CTransformFilter@@UAAJPB_WPAPAUIPin@@@Z)
1>cameraEmpty.obj : error LNK2001: unresolved external symbol "public: virtual long __cdecl CBaseFilter::JoinFilterGraph(struct IFilterGraph *,wchar_t const *)" (
?JoinFilterGraph@CBaseFilter@@UAAJPAUIFilterGraph@@PB_W@Z)
1>cameraEmpty.obj : error LNK2001: unresolved external symbol "public: virtual long __cdecl CBaseFilter::QueryVendorInfo(wchar_t * *)" (
?QueryVendorInfo@CBaseFilter@@UAAJPAPA_W@Z)

这样的链接错误来源于工程里面的一个设定:

Configuration Properties=>C/C++=>Language

把Treat wchar_t as Built-in Type的值设成 NO! 这样这一类的问题大致解决了。 很多时候到这一步就可以编译了,当然我指的是Release build已经可以通过编译了,但是在debug版本编译的时候还有一个问题存在,这就是第三步。

第三步。

cameraEmpty.obj : error LNK2001: unresolved external symbol "public: virtual unsigned long __cdecl CBaseFilter::NonDelegatingRelease(void)" (?NonDelegatingRelease@CBaseFilter@@UAAKXZ)

这个是很经典的问题,原因在于随SDK发布的这个strmbase的lib在debug模式下是错误的,要一个新的strmbase.lib和strmbase.pdb的包来替代。

具体步骤如下:
2.2.1        前期准备
         2.2.1.1        软件
          1、VS2005+SP1
          2、PB(5)
          3、SDK(对应平台)
                安装路径分别如下:
1、        VS2005:C:/Program Files/Microsoft Visual Studio 8
2、        PB:C:/WINCE500
3、        SDK:C:/Program Files/Windows CE Tools/wce500/
                2.2.1.2        环境变量配置
                        无
                2.2.2        编译过程
                        1、建立一个工程,有如下要求:SmartDevice,Win32,静态lib,空工程;

删除工程默认带的stdafx.h和stdafx.cpp文件
设置不使用预编译头的选择

2、将PB目录下C:/WINCE500/PUBLIC/DIRECTX/SDK/SAMPLE/DSHOW/BASECLASSES下的CPP文件拷贝到创建工程的文件夹下,打开BASECLASSES文件夹下的HEADER/source文件(文本文件方式),按照source文件中的文件列表,将指定的CPP文件加入到工程中;
 

3、修改文件wxutil.cpp文件
                                将#include <dsthread.cpp>修改为#include “dsthread.cpp”,即让编译器到本地目录中查找该文件。
4、        修改输出的lib文件的名称。
5、        编译

 

编译出来后,将产生的lib文件copy到应用程序工程目录下,编译,发现还是有链接错误

1>cameraEmpty.obj : error LNK2001: unresolved external symbol "public: virtual long __cdecl CBaseFilter::QueryVendorInfo(wchar_t * *)" (?QueryVendorInfo@CBaseFilter@@UAAJPAPA_W@Z)等

根据之前第二步处理方式判断,将lib工程的

Configuration Properties=>C/C++=>Language

把Treat wchar_t as Built-in Type的值设成 NO!

这样问题才最终解决了。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值