我正在将我们的一个项目从 VS6 迁移到 VS2008,并且在使用 mshtml.h 时遇到了以下编译错误:

1>c:\program files\microsoft sdks\windows\v6.0a\include\mshtml.h(5272) : error C2143: syntax error : missing '}' before 'constant'
1>c:\program files\microsoft sdks\windows\v6.0a\include\mshtml.h(5275) : error C2143: syntax error : missing ';' before '}'
1>c:\program files\microsoft sdks\windows\v6.0a\include\mshtml.h(5275) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\mshtml.h(28523) : error C2059: syntax error : '}'
1>c:\program files\microsoft sdks\windows\v6.0a\include\mshtml.h(28523) : error C2143: syntax error : missing ';' before '}'
1>c:\program files\microsoft sdks\windows\v6.0a\include\mshtml.h(28523) : error C2059: syntax error : '}'

在第一个错误语句进入 mshtml.h 代码的这一部分之后,指向“True = 1”行:
EXTERN_C const GUID CLSID_CDocument;
EXTERN_C const GUID CLSID_CScriptlet;
typedef
enum _BoolValue
    {   True    = 1,
    False   = 0,
    BoolValue_Max   = 2147483647L
    }   BoolValue;

EXTERN_C const GUID CLSID_CPluginSite;

看起来专家交换上的某个人也遇到了这个错误,但我宁愿不通过“7 天免费试用”来提升该网站的尊严。

任何建议将是最受欢迎的。

最佳答案

可能有一个 #define 改变了一些东西。尝试仅在 .cpp 上运行预处理器并生成 .i 文件。该设置位于项目属性页中。

编辑:此外,您可以通过滚动到页面底部来从其他专家站点获得答案。他们必须这样做,否则 Google 会将它们从索引中删除。

关于c++ - 用VS2008编译mshtml.h出现编译错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/118727/

10-11 22:11
查看更多