Solved

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

Posted on 2004-08-29
2
3,329 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

690 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