与IXMLDOMNode相关的C ++错误*

时间:2011-04-13 18:42:35

标签: c++ com mfc

我在编译我们的一个遗留COM组件时遇到了问题。我收到以下编译器错误:

error C2501: 'IXMLDOMNode' : missing storage-class or type specifiers
error C2061: syntax error : identifier 'IXMLDOMNode'

在.h文件中的这行代码:

IXMLDOMNode* CreateChildNodeOfItem(IXMLDOMNode* pNode, DOMNodeType nodeType, CString strName);

我认为IXMLDOMNode来自这个库:

#include <msxml.h>

我是否需要安装缺少的SDK?

修改:

// stdafx.h : include file for standard system include files,
//  or project specific include files that are used frequently, but
//      are changed infrequently
//

#if !defined(AFX_STDAFX_H__84FB3EAC_AE73_4076_9DF6_E48B18DA7098__INCLUDED_)
#define AFX_STDAFX_H__84FB3EAC_AE73_4076_9DF6_E48B18DA7098__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define VC_EXTRALEAN        // Exclude rarely-used stuff from Windows headers

#include <afxwin.h>         // MFC core and standard components
#include <afxext.h>         // MFC extensions
#include <afxdisp.h>        // MFC Automation classes
#include <afxdtctl.h>       // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h>         // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT

#include <atlbase.h>
#include <msxml.h>

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_STDAFX_H__84FB3EAC_AE73_4076_9DF6_E48B18DA7098__INCLUDED_)

2 个答案:

答案 0 :(得分:3)

您应该展示更多背景信息。也许你应该有资格

MSXML::IXMLDOMDocument

另请参阅:http://support.microsoft.com/kb/301939了解平台不兼容性

答案 1 :(得分:1)

我改变了我包含msxml的方式,似乎修复了编译错误。我改变了:

#include <msxml.h>

#import <msxml.dll> raw_interfaces_only
using namespace MSXML;