-
May 23rd, 2002, 03:06 AM
#1
include msxml couse compilation error PLEASE HELP
Hi.
I'm spending too much time on this problem and yet have no results.
My problem is a simple one.
I want to use the xml parse, so I'm trying to add
#include <msxml.h> to .h file in my dll project, so I can use the IXMLDOMsomething.
But thane these compilation error are generated:
error C2146: syntax error : missing ';' before identifier 'IXMLDOMImplementation'
fatal error C1004: unexpected end of file found
Without this #include there is no compilation error at all. So it's not a problem in my code like "#ifndef #endif problem which is typical to error C1004.
Please help it's very important.
Thanks Itzik.
-
May 23rd, 2002, 03:19 AM
#2
try this instead
place in stdafx.h
#import <msxml.dll> named_guids
using namespace MSXML;
and the following in main or function
Code:
HRESULT hr;
IXMLDOMDocumentPtr m_plDomDocument;
IXMLDOMElementPtr m_pDocRoot;
hr = m_plDomDocument.CreateInstance( CLSID_DOMDocument );
if (FAILED(hr))
{
_com_error er(hr);
cout << er.ErrorMessage() << endl;
return 1;
}
// specify xml file name
CString strFileName ("D:\\TEST2.xml");
// convert xml file name string to something COM can handle (BSTR)
_bstr_t bstrFileName;
bstrFileName = strFileName.AllocSysString();
// call the IXMLDOMDocumentPtr's load function to load the XML document
_variant_t vResult;
vResult = m_plDomDocument->load( bstrFileName);
if( (!(bool)vResult) )
{
cout << endl << "XML Document FAILED to load!" << endl;
return 1;
}
// now that the document is loaded, we need to initialize the root pointer
m_pDocRoot = m_plDomDocument->documentElement;
cout << endl << "XML Document loaded successfully!" << endl;
int nRecords = 0;
for( IXMLDOMNodePtr pChild=m_pDocRoot->firstChild; NULL!=pChild; pChild=pChild->nextSibling )
{
nRecords++;
}
cout << endl << "Total Records: " << nRecords << endl;
-
May 23rd, 2002, 03:39 AM
#3
Why this code doesn't work? Do you have any idea?
// Parser.h /////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
#include "X3DParser.h"
#include <msxml.h>
// This class is exported from the X3DParser.dll
class X3DPARSER_API CX3DParser {
public:
CX3DParser(){};
virtual ~CX3DParser(){};
// TODO: add your methods here.
protected:
IXMLDOMDocument* m_pDoc;
IXMLDOMNodeList* m_pNodeList;
IXMLDOMNode* m_pNode;
};
-
May 23rd, 2002, 04:47 AM
#4
this seems something like the problem I had,
you may want to try changing the project settings under the tag c/c++ --- category: precompiled headers
select: not using precompiled headers.
in my case it helped.
-
December 20th, 2006, 10:38 AM
#5
Re: include msxml couse compilation error PLEASE HELP
Check the header file like "stdafx.h". This may have an entry like #define WIN32_LEAN_AND_MEAN
If this WIN32_LEAN_AND_MEAN is defined some of the header files which are rarely used do not get included. Removing this entry may help.
-
September 22nd, 2008, 04:05 PM
#6
Re: include msxml couse compilation error PLEASE HELP
Originally Posted by prasad_chawak
Check the header file like "stdafx.h". This may have an entry like #define WIN32_LEAN_AND_MEAN
If this WIN32_LEAN_AND_MEAN is defined some of the header files which are rarely used do not get included. Removing this entry may help.
well done prasad. You're right.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|