error LNK2001: unresolved external symbol "int g_cTemplates" (?g_cTemplates@@3HA)(转)
原文转自:http://blog.sina.com.cn/s/blog_639a2ad70101kpen.html
编译directshow若干问题的解决
use vs2005 compiler directshow baseclasses has something error
1.ctlutil.h
modify as below:
//operator=(LONG);
COARefTime& operator=(LONG);
2.winutil.cpp
modify as below:
UINT Count;
for (Count = 0;Count < Result;Count++) {
3.outputq.cpp
modify as below:
long iDone;
for (iDone = 0;
4.wxdebug.cpp
modify as below:
//static g_dwLastRefresh = 0;
static DWORD g_dwLastRefresh = 0;
如果編譯程式出現
error LNK2019: 無法解析的外部符號 "int __stdcall lstrcmpWInternal
error LNK2019: 無法解析的外部符號 "int __cdecl wsprintfWInternal
error LNK2019: 無法解析的外部符號 "int __stdcall lstrcmpiWInternal
之類的錯誤
這是baseclasses編譯時有個設定要變更
就是project屬性->組態屬性->C/C++->語言之下的 "將wchar_t當作Built-in型別" 設為false
就可以解決上述link error的問題
如果編譯程式link strmbase.lib or strmbasd.lib出現以下的error
strmbasd.lib(dllentry.obj) : error LNK2001: unresolved external symbol "class CFactoryTemplate * g_Templates" (?g_Templates@@3PAVCFactoryTemplate@@A)strmbasd.lib(dllsetup.obj) : error LNK2001: unresolved external symbol "int g_cTemplates" (?g_cTemplates@@3HA)
则重新修改baseclasses project的内容
CFactoryTemplate g_Templates[1] = {
{ L"SystemClock", &CLSID_SystemClock, CSystemClock::CreateInstance} //修改后;
// {&CLSID_SystemClock, CSystemClock::CreateInstance} //原本的;
};
另外在baseclasses工程的 vc Project->Settings...->C/C++的 preprocessor definitions:加入FILTER_DLL
然后重新编译 strmbase.lib and strmbasd.lib 即可