建议在Visual Studio 2005中把PSDK的bin、include、lib目录的顺序都设到VC的目录之前,这样避免出现不必要的问题(我曾经忘了设置bin目录,结果因为VC自带的MIDL编译程序较老,出现了编译错误)。
error MIDL2025 : syntax error : expecting ] or , near "annotation"
This error is caused by using the Visual Studio 2005 MIDL compiler instead of the Windows SDK ...
----------------------------------------------------------------------------------------------------
在编译的时候可能会碰到以下的链接错误:
error LNK2019: unresolved external symbol "wchar_t * __stdcall _com_util::ConvertStringToBSTR(char const *)" (?ConvertStringToBSTR@_com_util@@YGPA_WPBD@Z) referenced in function "public: __thiscall _bstr_t:ata_t:ata_t(char const *)" (??0Data_t@_bstr_t@@QAE@PBD@Z)
根据MSDN Forums里面的这篇帖子:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=111716&SiteID=1
是comdef.h的定义出了问题。
讨论建议:“
the best workaround is to immediately DELETE comdef.h from your
C:\program files\microsoft sdks\Windows\v6.0\include
folder after installing the Vista SDK and integrating with Visual C++ 2005.
”为了避免以后需要PSDK的comdef.h,我只是将它改了名。
----------------------------------------------------------------------------------------------------
另外GMFPlay编译成Unicode版本的过程中会遇到很多错误提示,把所有的char都改成TCHAR,string都改成tstring,ostringstream改成tostringstream。把下面两个宏放到player.h或者stdafx.h里面即可。
#ifdef _UNICODE
#define tstring wstring
#else
#define tstring string
#endif
#ifdef _UNICODE
#define tostringstream wostringstream
#else
#define tostringstream ostringstream
#endif
----------------------------------------------------------------------------------------------------