Article ID: 269194 - Last Review: December 5, 2003 - Revision: 3.1 PRB: Compiler Errors When You Use #import with XMLThis article was previously published under Q269194 SYMPTOMS
When you use the #import feature of Visual C++ with the Msxml.dll, Msxml2.dll, or Msxml3.dll file, you may receive the following compiler error messages:
error C2872: 'DOMDocument' : ambiguous symbol
-or-
warning C4099: 'DOMDocument' : type name first seen using 'class' now seen using 'struct'
error C2011: 'IXMLDOMImplementation' : 'struct' type redefinition
CAUSE
The #import feature includes a file named Comdef.h, which indirectly includes files that include Msxml.h. This is necessary because Comdef.h defines some common GUIDs and contains the following:
RESOLUTION
The "no_namespace" attribute cannot be used with #import with the XML DLL. The "ambiguous symbol" error can be avoided by using the Msxml.h header file from the Visual C++ 6.0 Include folder. This Msxml.h file contains only the old XML definitions that are necessary to satisfy Comdef.h, but doesn't redefine such newer symbols as DOMDocument. If you use the Platform SDK or XML SDK header files, you can add those Include folders after the Visual C++ Include folder when you use #import. To do this, in Visual C++, on the Tools menu, click Options, and then click the Directories tab. If a newer version of MSXML has been installed in side-by-side mode, you must explicitly use the Globally Unique Identifiers (GUIDs) or ProgIDs for that version to run the sample code. For example, MSXML version 4.0 can only be installed in side-by-side mode. For additional information about the code changes that are required to run the sample code with the MSXML 4.0 parser, click the following article number to view the article in the Microsoft Knowledge Base: 305019
(http://support.microsoft.com/kb/305019/EN-US/
)
INFO: MSXML 4.0 Specific GUIDs and ProgIds For additional information, click the article number below
to view the article in the Microsoft Knowledge Base:
316317
(http://support.microsoft.com/kb/316317/EN-US/
)
PRB: Compiler Errors When Using #import with XML in Visual C++ .NET
| Article Translations
|
Back to the top
