Solved

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

Posted on 2004-08-29
2
3,243 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

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…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

705 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

19 Experts available now in Live!

Get 1:1 Help Now