Directshow 的 SDK中的 playwndasf 是一个播放器的例子,使用 VS2008 编译出现如下错误:
******************************************************************************************
PlayWndASF.cpp
urllaunch.cpp
Linking...
LINK : fatal error LNK1181: cannot open input file "../../common/wmstub.lib"
Error executing link.exe.
PlayWndASF.exe - 1 error(s), 0 warning(s)
******************************************************************************************
需要wmstub.lib 库支持,这个库从网上可以下到,不过需要注册的:
http://bbs.lmtw.com/dispbbs.asp?BoardID=102&ID=120939&replyID=7912&skin=1
拷贝到: /DXSDK/Samples/C++/DirectShow/Common/ 下面重新编译还存在上述错误。
进一步的解决办法是注释掉 keyprovider.cpp 中的如下语句:
//#pragma message("---------------------------------------------------------------------------------------")
//#pragma message("NOTE: To link and run this sample, you must install the Windows Media Format SDK 7.1.1.")
//#pragma message("/n")
//#pragma message(" After downloading the Format SDK, you can extract a public version of the")
//#pragma message(" WMStub.LIB library, which should be copied to the Samples//C++//DirectShow//Common folder.")
//#pragma message(" This library is necessary for enabling Windows Media content.")
//#pragma message("/n")
//#pragma message(" Without this library in the Common folder, the link will fail with:")
//#pragma message(" LNK1104: cannot open file '..//..//common//wmstub.lib'")
//#pragma message("/n")
//#pragma message(" If you remove the WMStub.lib from the project's linker settings, the linker")
//#pragma message(" will fail with this unresolved reference:")
//#pragma message(" WMCreateCertificate")
//#pragma message("---------------------------------------------------------------------------------------")
然后连接就会通过。
如果编译出现如下错误:
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
这个和解决编译BaseClasses 的错误一样, 可以用wd4430 来解决;具体的在工程选项中的 c/c++ Command Line 中添加 /wd4430 即可。