解决VS2010 编译Duilib 错误
1>f:\mystudy\myprogramers\duilib\Control/UIFlash.h(10): warning C4192: 导入类型库“IServiceProvider”时自动排除“..\Utils/Flash11.tlb”
1> UIWebBrowser.cpp
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\dispex.h(217): error C2371: “IDispatchEx”: 重定义;不同的基类型
1> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\dispex.h(53) : 参见“IDispatchEx”的声明
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\dispex.h(435): error C2872: “IDispatchEx”: 不明确的符号
1> 可能是“c:\program files (x86)\microsoft sdks\windows\v7.0a\include\dispex.h(217) : IDispatchEx”
1> 或 “f:\mystudy\myprogramers\duilib\build\debug\flash11.tlh(297) : ShockwaveFlashObjects::IDispatchEx”
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\dispex.h(869): error C2872: “IDispatchEx”: 不明确的符号
1> 可能是“c:\program files (x86)\microsoft sdks\windows\v7.0a\include\dispex.h(217) : IDispatchEx”
1> 或 “f:\mystudy\myprogramers\duilib\build\debug\flash11.tlh(297) : ShockwaveFlashObjects::IDispatchEx”
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\dispex.h(887): error C2872: “IDispatchEx”: 不明确的符号
1> 可能是“c:\program files (x86)\microsoft sdks\windows\v7.0a\include\dispex.h(217) : IDispatchEx”
1> 或 “f:\mystudy\myprogramers\duilib\build\debug\flash11.tlh(297) : ShockwaveFlashObjects::IDispatchEx”
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\mshtml.h(4715): error C2872: “IDispatchEx”: 不明确的符号
1> 可能是“c:\program files (x86)\microsoft sdks\windows\v7.0a\include\dispex.h(217) : IDispatchEx”
1> 或 “f:\mystudy\myprogramers\duilib\build\debug\flash11.tlh(297) : ShockwaveFlashObjects::IDispatchEx”
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\mshtml.h(4738): error C2872: “IDispatchEx”: 不明确的符号
1> 可能是“c:\program files (x86)\microsoft sdks\windows\v7.0a\include\dispex.h(217) : IDispatchEx”
1> 或 “f:\mystudy\myprogramers\duilib\build\debug\flash11.tlh(297) : ShockwaveFlashObjects::IDispatchEx”
解决办法:
#ifndef __UIFLASH_H__
#define __UIFLASH_H__
#pragma once
// \Utils\Flash11.tlb 为Flash11接口文件,部分方法在低版本不存在,使用需注意
#import "..\Utils/Flash11.tlb" raw_interfaces_only, named_guids //VS2008 没有问题 VS2010编译出错
//解决方案一:
//下面的可以兼容VS2010编译不出错
//#import "..\Utils/Flash11.tlb" raw_interfaces_only, named_guids, rename("IDispatchEx","IMyDispatchEx")
//解决方案二:
//下面的兼容性更好更高版本都能编译通过
//#import "PROGID:ShockwaveFlash.ShockwaveFlash" raw_interfaces_only, named_guids, rename("IDispatchEx","IMyDispatchEx")
/* Don't add raw_ to method names */
/* Named guids and declspecs */
/* fix conflicting with IDispatchEx ant dispex.h */
using namespace ShockwaveFlashObjects;
更改Duilib控件筛选器下UIFlash.h文件中上述内容,注释中有说明,下面下面两种解决方案中的任何一种都可以。