Solved

Compiling error with MSXML.DLL in VC++ .NET

Posted on 2004-08-29
2
3,264 Views
Last Modified: 2009-01-14
Hi All,

I'm trying to compile a code I write in VC++ 6 to VC++ .NET.

Some parts of the code are using the MSXML to read/write xml files.
When I compile the code I get this erros on the xml DOM objects:

error C2872: 'IXMLDOMNodePtr' : ambiguous symbol

On the StdAfx.h I have this declaration:

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

Please help,
Thanks,
Doron Tal
0
Comment
Question by:doront99
2 Comments
 
LVL 19

Accepted Solution

by:
drichards earned 125 total points
ID: 11928101
If you look closely at the output of the compiler, you see:

d:\DevProjects\CPPConsole\CPPConsole.cpp(77) : error C2872: 'IXMLDOMNodePtr' : ambiguous symbol
        could be 'd:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\comdefsp.h(1249) : _com_ptr_t<_IIID> IXMLDOMNodePtr'
        with
        [
            _IIID=_com_IIID<IXMLDOMNode,& _GUID_2933bf80_7b36_11d2_b20e_00c04f983e60>
        ]
        or       'd:\DevProjects\CPPConsole\Debug\msxml.tlh(105) : MSXML::IXMLDOMNodePtr'


VC7 has a new file 'comdefsp.h' that predefines smart pointers for a lot of interfaces, including the MSXML ones.  comdefsp.h is included by 'comdef.h' which is included by 'msxml.tlh'.  Thus you have two definitions of all the XML interface smart pointers.  If you try to '#import <msxml.dll> no_namespace' you really have problems.  To solve the problem, you can either

1) drop the 'using namespace MSXML;' or

2) explicitly specify either 'MSXML::' or '::' in front of all the ambiguous symbols.

Dropping 'using namespace MSXML;' (option 1) will mean that you need to put 'MSXML::' in front of all the XML stuff, not just the smart pointers.  Take your pick.
0
 

Author Comment

by:doront99
ID: 11928937
Thank you. Now it's working.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Setting font in GroupBox 10 136
Help with FindIndex method; using predicate. 5 55
Visual Studio 2015 install failing. 18 70
Third Party On Screen Keyboard, numeric only. 9 53
The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now