牵着老婆满街逛

严以律己,宽以待人. 三思而后行.
GMail/GTalk: yanglinbo#google.com;
MSN/Email: tx7do#yahoo.com.cn;
QQ: 3 0 3 3 9 6 9 2 0 .

在activex控件工程中使用directshow,编译时link错误的解决方法

转载自:http://www.wangchao.net.cn/bbsdetail_839548.html

错误为:
strmbase.lib(dllentry.obj) : error LNK2001: unresolved external symbol "class CFactoryTemplate * g_Templates" (g_Templates@@3PAVCFactoryTemplate@@A)
strmbase.lib(dllentry.obj) : error LNK2001: unresolved external symbol "int g_cTemplates" (g_cTemplates@@3HA"g_cTemplates@@3HA)

原因好像出在标准C上,与用户代码无关。
----------------------------解决方案--------------------------------------
加入下面加上以下代码,重新编译即可.
  ///////////////////////////////////////////////////////////////////////////// 
  // DllGetClassObject 
  extern "C" 
  STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID
* ppv) 
  

  AFX_MANAGE_STATE(AfxGetStaticModuleState()); 
  
return AfxDllGetClassObject(rclsid, riid, ppv); 
  }
 
  
///////////////////////////////////////////////////////////////////////////// 
  // DllCanUnloadNow 
  extern "C" 
  STDAPI DllCanUnloadNow(
void
  

  AFX_MANAGE_STATE(AfxGetStaticModuleState()); 
  
return AfxDllCanUnloadNow(); 
  }
 
  
////////////////////////////////////////////////////////////////////////////



posted on 2012-08-17 17:01 杨粼波 阅读(607) 评论(0)  编辑 收藏 引用 所属分类: C++Windows


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理