在 Visual C++ 上使用 msxml6.h 时出错
Errors using msxml6.h on visual c++
在Visual Studio 2010中,如果我启动一个控制台项目并 #include 这工作正常,但是如果我启动一个win32项目并 #include,它会在编译过程中返回许多错误。
为什么?
Error 1 error C2146: syntax error : missing ';' before identifier 'IXMLDOMImplementation' c:program files (x86)microsoft sdkswindowsv7.0aincludemsxml6.h 49 1 provamsxml6
Error 2 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:program files (x86)microsoft sdkswindowsv7.0aincludemsxml6.h 49 1 provamsxml6
Error 3 error C2146: syntax error : missing ';' before identifier 'IXMLDOMImplementation' c:program files (x86)microsoft sdkswindowsv7.0aincludemsxml6.h 49 1 provamsxml6
Error 4 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:program files (x86)microsoft sdkswindowsv7.0aincludemsxml6.h 49 1 provamsxml6
Error 5 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:program files (x86)microsoft sdkswindowsv7.0aincludemsxml6.h 49 1 provamsxml6
Error 6 error C2086: 'int IXMLDOMImplementation' : redefinition c:program files (x86)microsoft sdkswindowsv7.0aincludemsxml6.h 49 1 provamsxml6
Error 7 error C2146: syntax error : missing ';' before identifier 'IXMLDOMNode' c:program files (x86)microsoft sdkswindowsv7.0aincludemsxml6.h 55 1 provamsxml6
Warning 8 warning C4091: '' : ignored on left of 'interface' when no variable is declared c:program files (x86)microsoft sdkswindowsv7.0aincludemsxml6.h 55 1 provamsxml6
Error 9 error C2146: syntax error : missing ';' before identifier 'IXMLDOMDocumentFragment' c:program files (x86)microsoft sdkswindowsv7.0aincludemsxml6.h 61 1 provamsxml6
Warning 10 warning C4091: '' : ignored on left of 'interface' when no variable is declared c:program files (x86)microsoft sdkswindowsv7.0aincludemsxml6.h 61 1 provamsxml6
Error 11 error C2146: syntax error : missing ';' before identifier 'IXMLDOMDocument' c:program files (x86)microsoft sdkswindowsv7.0aincludemsxml6.h 67 1 provamsxml6
Warning 12 warning C4091: '' : ignored on left of 'interface' when no variable is declared c:program files (x86)microsoft sdkswindowsv7.0aincludemsxml6.h 67 1 provamsxml6
Error 13 error C2146: syntax error : missing ';' before identifier 'IXMLDOMDocument2' c:program files (x86)microsoft sdkswindowsv7.0aincludemsxml6.h 73 1 provamsxml6
Warning 14 warning C4091: '' : ignored on left of 'interface' when no variable is declared c:program files (x86)microsoft sdkswindowsv7.0aincludemsxml6.h 73 1 provamsxml6
Error 15 error C2146: syntax error : missing ';' before identifier 'IXMLDOMDocument3' c:program files (x86)microsoft sdkswindowsv7.0aincludemsxml6.h 79 1 provamsxml6
Warning 16 warning C4091: '' : ignored on left of 'interface' when no variable is declared c:program files (x86)microsoft sdkswindowsv7.0aincludemsxml6.h 79 1 provamsxml6
Error 17 error C2146: syntax error : missing ';' before identifier 'IXMLDOMNodeList' c:program files (x86)microsoft sdkswindowsv7.0aincludemsxml6.h 85 1 provamsxml6
Warning 18 warning C4091: '' : ignored on left of 'interface' when no variable is declared c:program files (x86)microsoft sdkswindowsv7.0aincludemsxml6.h 85 1 provamsxml6
Error 19 error C2146: syntax error : missing ';' before identifier 'IXMLDOMNamedNodeMap' c:program files (x86)microsoft sdkswindowsv7.0aincludemsxml6.h 91 1 provamsxml6
Warning 20 warning C4091: '' : ignored on left of 'interface' when no variable is declared c:program files (x86)microsoft sdkswindowsv7.0aincludemsxml6.h 91 1 provamsxml6
Error 21 error C2146: syntax error : missing ';' before identifier 'IXMLDOMCharacterData' c:program files (x86)microsoft sdkswindowsv7.0aincludemsxml6.h 97 1 provamsxml6
Warning 22 warning C4091: '' : ignored on left of 'interface' when no variable is declared c:program files (x86)microsoft sdkswindowsv7.0aincludemsxml6.h 97 1 provamsxml6
Error 23 error C2146: syntax error : missing ';' before identifier 'IXMLDOMAttribute' c:program files (x86)microsoft sdkswindowsv7.0aincludemsxml6.h 103 1 provamsxml6
Warning 24 warning C4091: '' : ignored on left of 'interface' when no variable is declared c:program files (x86)microsoft sdkswindowsv7.0aincludemsxml6.h 103 1 provamsxml6
Error 25 error C2146: syntax error : missing ';' before identifier 'IXMLDOMElement' c:program files (x86)microsoft sdkswindowsv7.0aincludemsxml6.h 109 1 provamsxml6
Warning 26 warning C4091: '' : ignored on left of 'interface' when no variable is declared c:program files (x86)microsoft sdkswindowsv7.0aincludemsxml6.h 109 1 provamsxml6
Error 27 error C2146: syntax error : missing ';' before identifier 'IXMLDOMText' c:program files (x86)microsoft sdkswindowsv7.0aincludemsxml6.h 115 1 provamsxml6
Warning 28 warning C4091: '' : ignored on left of 'interface' when no variable is declared c:program files (x86)microsoft sdkswindowsv7.0aincludemsxml6.h 115 1 provamsxml6
Error 29 error C2146: syntax error : missing ';' before identifier 'IXMLDOMComment' c:program files (x86)microsoft sdkswindowsv7.0aincludemsxml6.h 121 1 provamsxml6
Warning 30 warning C4091: '' : ignored on left of 'interface' when no variable is declared c:program files (x86)microsoft sdkswindowsv7.0aincludemsxml6.h 121 1 provamsxml6
缺少的是#include <ole2.h>
或其某些部分。
定义WIN32_LEAN_AND_MEAN
时,Ole2 是从 Windows.h
中删除的标头之一。
如果定义了 Ole2 INC_OLE2
则可以重新添加。
如果您提供标题并且不确定用户可能定义的内容,那么您可以寻求安全
#if !defined(INC_OLE2) && defined(WIN32_LEAN_AND_MEAN)
#include <ole2.h>
#endif
#include <msxml2.h>
问题是 stdafx.h 文件中的 #define WIN32_LEAN_AND_MEAN,请删除此条目以解决。
相关文章:
- 访问者访问变体并返回不同类型时出错
- 在Linux for Windows上编译C++代码时出错
- 读取文件的最后一行并输入到链接列表时出错
- 重载操作程序时出错>>用于类中的字符串 memebr
- 调用专用模板时出错"no matching function for call to [...]"
- C++-试图将函数指针推回到另一个CPP文件中的矢量时出错
- LINK 尝试使用 OpenSSL evp aes 256 c++ 时出错
- 在Google Kick start中提交时出错
- 在c++中访问int到类对象的映射时出错
- 分段错误当我试图运行程序时出错
- 使用dynamic_cast和构造函数时出错
- CHECK(调用)函数在Google Colab中出错
- 用pybind11包装C++抽象类时出错
- 为x86而非x64编译时出错
- 从R调用C++函数并对其进行集成时出错
- 这个函数哪里出错了
- C++ 创建包含链表和字符串的对象的链接列表时出错
- 为重写std::exception的库生成swig接口时出错
- 导入/导出变量时出错
- 在 Visual C++ 上使用 msxml6.h 时出错