程序代码
/*IXMLDOMNode* GetNodeByElement(IXMLDOMElement* pElement)
功能:根据元素指针得到相应的节点指针
参数;IXMLDOMElement* pElement-元素指针*/
MSXML2::IXMLDOMNode* ParseXMLDOM::GetNodeByElement(MSXML2::IXMLDOMElement* pElement)
{
MSXML2::IXMLDOMNode* pNode=NULL;
pElement->QueryInterface(IID_IXMLDOMNode,(void**)&pNode);
return pNode;
}
一运行就说 error C2065: 'IID_IXMLDOMNode' : undeclared identifier,是怎么回事啊
谢谢赐教

解决方案 »

  1.   

    // You might need to add the msxml4/sdk/(inc, lib) directories 
    // to the Tools->Options...->Directories in Visual Studio.
    //
    // You might also need to append "msxml2.lib" to the
    // Project->Settings...->Link->Object/Libray Modules field.
      

  2.   

    楼上的同志说的好像不对,如果没加入inc和lib,恐怕报错说没定义的就不只那一条了吧。我也遇到了相同了问题DIID_XMLDOMDocumentEvents未定义SDK说
    Automation is enabled for the class to enable it to connect 
    to the Connection point (DIID_XMLDOMDocumentEvents).
    该怎末解决?
      

  3.   

    我这几天也遇到这个问题,好像和vc版本和xml的版本都相关呢,调试起来挺麻烦的,我最后在使用到的cpp文件前加了
    #include "msxml.h"# import <msxml4.dll> raw_interfaces_only你试试看吧
      

  4.   

    你试试运行sdk的例子,如果那都不行,恐怕问题不在程序了