Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2004-08-29
2
Medium Priority
?
3,375 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 500 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

610 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