C++ error relating to IXMLDOMNode*
I'm having trouble compiling one of o开发者_如何学运维ur legacy COM components. I get the following compiler error:
error C2501: 'IXMLDOMNode' : missing storage-class or type specifiers
error C2061: syntax error : identifier 'IXMLDOMNode'
On this line of code in a .h file:
IXMLDOMNode* CreateChildNodeOfItem(IXMLDOMNode* pNode, DOMNodeType nodeType, CString strName);
I assumed IXMLDOMNode was coming from this library:
#include <msxml.h>
Do I need to install a missing SDK?
Edit:
// 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_)
You should show more context. Perhaps you should qualify
MSXML::IXMLDOMDocument
See also: http://support.microsoft.com/kb/301939 for platform incompatibilities
I changed the way I'm including msxml and it seems to have fixed the compiler errors. I changed:
#include <msxml.h>
to
#import <msxml.dll> raw_interfaces_only
using namespace MSXML;
精彩评论