最新版Duilib在VS2012下编译错误的解决方法
svn了好几次最新版本的项目源代码, 在VS2012下编译老是出错, 改了后没记录, 结果又忘记, 所以在此记录下.
这个问题很普遍, 非常多的人遇到.
至于其它的示例Demo的错误则简单修改项目属性即可.
好了,错误描述就像下面这样:
1>------ Build started: Project: DuiLib, Configuration: UnicodeDebug Win32 ------
1> StdAfx.cpp
1>c:\users\yangtao\desktop\new folder\duilib\Control/UIFlash.h(10): warning C4192: automatically excluding 'IServiceProvider' while importing type library '..\Utils/Flash11.tlb'
1> UIWebBrowser.cpp
1>c:\program files\windows kits\8.0\include\um\dispex.h(228): error C2371: 'IDispatchEx' : redefinition; different basic types
1> c:\program files\windows kits\8.0\include\um\dispex.h(45) : see declaration of 'IDispatchEx'
1>c:\program files\windows kits\8.0\include\um\dispex.h(455): error C2872: 'IDispatchEx' : ambiguous symbol
1> could be 'c:\program files\windows kits\8.0\include\um\dispex.h(228) : IDispatchEx'
1> or 'c:\users\yangtao\desktop\new folder\duilib\build\debug_u\flash11.tlh(297) : ShockwaveFlashObjects::IDispatchEx'
1>c:\program files\windows kits\8.0\include\um\dispex.h(791): error C2371: 'ICanHandleException' : redefinition; different basic types
1> c:\program files\windows kits\8.0\include\um\dispex.h(73) : see declaration of 'ICanHandleException'
1>c:\program files\windows kits\8.0\include\um\dispex.h(977): error C2872: 'IDispatchEx' : ambiguous symbol
1> could be 'c:\program files\windows kits\8.0\include\um\dispex.h(228) : IDispatchEx'
1> or 'c:\users\yangtao\desktop\new folder\duilib\build\debug_u\flash11.tlh(297) : ShockwaveFlashObjects::IDispatchEx'
1>c:\program files\windows kits\8.0\include\um\dispex.h(995): error C2872: 'IDispatchEx' : ambiguous symbol
1> could be 'c:\program files\windows kits\8.0\include\um\dispex.h(228) : IDispatchEx'
1> or 'c:\users\yangtao\desktop\new folder\duilib\build\debug_u\flash11.tlh(297) : ShockwaveFlashObjects::IDispatchEx'
1>C:\Program Files\Windows Kits\8.0\Include\um\mshtml.h(9754): error C2872: 'IDispatchEx' : ambiguous symbol
1> could be 'c:\program files\windows kits\8.0\include\um\dispex.h(228) : IDispatchEx'
1> or 'c:\users\yangtao\desktop\new folder\duilib\build\debug_u\flash11.tlh(297) : ShockwaveFlashObjects::IDispatchEx'
1>C:\Program Files\Windows Kits\8.0\Include\um\mshtml.h(9778): error C2872: 'IDispatchEx' : ambiguous symbol
1> could be 'c:\program files\windows kits\8.0\include\um\dispex.h(228) : IDispatchEx'
1> or 'c:\users\yangtao\desktop\new folder\duilib\build\debug_u\flash11.tlh(297) : ShockwaveFlashObjects::IDispatchEx'
解决方案:
修改UIWebBrowser.cpp和UIWebBrowser.h:
修改前:
修改后:
女孩不哭 @ cnblogs.com/memset @ 2014-05-11