使用VC++6编译DirectShow项目, 遇到这样的问题:
--------------------Configuration: testdx - Win32 Debug--------------------
Linking...
LINK : warning LNK4049: locally defined symbol "_sprintf" imported
strmbasd.lib(wxdebug.obj) : error LNK2001: unresolved external symbol __imp__strrchr
Debug/testdx.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
testdx.exe - 2 error(s), 1 warning(s)
经过检查, 在"progject setting"中的link->Object/Library modules中有"strmbasd.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ", 而在Tools->Options->Directories->Library files中为"D:/DXSDK/SAMPLES/C++/DIRECTSHOW/BASECLASSES/RELEASE", 在这个目录下只有"strbase.lib"文件, "strmbasd.lib"是Debug版本, 所以加入
"D:/DXSDK/SAMPLES/C++/DIRECTSHOW/BASECLASSES/DEBUG_UNICODE".
另外Library的排放顺序也有关系, 如果将其放在最后,
D:/DXSDK/SAMPLES/C++/DIRECTSHOW/BASECLASSES/RELEASE
D:/DXSDK/Lib
D:/Program Files/Microsoft Visual Studio/VC98/LIB
D:/Program Files/Microsoft Visual Studio/VC98/MFC/LIB
D:/DXSDK/SAMPLES/C++/DIRECTSHOW/BASECLASSES/DEBUG_UNICODE
编译就会出现如下的错误
Linking...
LINK : warning LNK4049: locally defined symbol "_sprintf" imported
strmbasd.lib(wxdebug.obj) : error LNK2001: unresolved external symbol __imp__strrchr
Debug/testdx.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
testdx.exe - 2 error(s), 1 warning(s)
将顺序改为
D:/DXSDK/SAMPLES/C++/DIRECTSHOW/BASECLASSES/RELEASE
D:/DXSDK/Lib
D:/DXSDK/SAMPLES/C++/DIRECTSHOW/BASECLASSES/DEBUG_UNICODE
D:/Program Files/Microsoft Visual Studio/VC98/LIB
D:/Program Files/Microsoft Visual Studio/VC98/MFC/LIB
编译就能正常通过.