我正在尝试编译我继承的项目,然后遇到了这个错误。以下是一些相关代码:
#include <msxml.h>
...
HRESULT hr;
hr = pDoc.CreateInstance(__uuidof(MSXML2::DOMDocument));
有人可以帮忙吗?
最佳答案
我在 Windows 8 中看到了类似的问题。似乎 MSXML 6.0 没有公开 DOMDocument,但它确实公开了 DOMDocument60。为了帮助其他人通过搜索到达这里,您可能还会看到的编译器错误是: 错误 C2039:“DOMDocument”:不是“MSXML2”的成员
尝试进行以下更改以明确使用 6.0 接口(interface):
#import "msxml6.dll"
...
HRESULT hr;
hr = pDoc.CreateInstance(__uuidof(MSXML2::DOMDocument60));
我看到其他人也有这个问题,但是是在 Excel 自动化的背景下。请参阅讨论 here .
关于c++ - 智能感知 : namespace "MSXML2" has no member "DOMDocument" in VS2012,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14413055/