加入了DirectShow的基类链接库后,如果此时编译就会出现以下编译错误:
strmbasd.lib(wxutil.obj) : error LNK2019: 无法解析的外部符号 __imp__timeGetTime@0
strmbasd.lib(wxutil.obj) : error LNK2019: 无法解析的外部符号 __imp__timeSetEvent@20
strmbasd.lib(dllentry.obj) : error LNK2001: 无法解析的外部符号 "class CFactoryTemplate *
g_Templates" (?g_Templates@@3PAVCFactoryTemplate@@A)strmbasd.lib(dllentry.obj) : error LNK2001: 无法解析的外部符号 "int g_cTemplates"
(?g_cTemplates@@3HA)
解决的办法是:
1、在附加依赖项中再加入winmm.lib链接库文件,这样将不会再出现error LNK2019的编译错误。
2、在项目的TestOcxCtrl.h头文件的后面添加如下的代码将消除error LNK2001的编译错误:
extern "C"STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv){AFX_MANAGE_STATE(AfxGetStaticModuleState());return AfxDllGetClassObject(rclsid, riid, ppv);}/// DllCanUnloadNowextern "C"STDAPI DllCanUnloadNow(void){AFX_MANAGE_STATE(AfxGetStaticModuleState());return AfxDllCanUnloadNow();}
转载于:https://www.cnblogs.com/nightnine/p/9253241.html