-
March 9th, 2006, 06:55 AM
#1
Error importing msxml3.dll
In my file I import msxml3 like this:
#import "msxml3.dll"
using MSXML2::IXMLDOMDocument2Ptr;
using MSXML2::IXMLDOMNodePtr;
And i get the following error:
error C2874: using-declaration causes a multiple declaration of 'MSXML2::IXMLDOMNodePtr'
c:\Source\3.0\modes\Q3DPublisher\Debug\msxml3.tlh(287) : see declaration of 'MSXML2::IXMLDOMNodePtr'
Note that eliminating the "using MSXML2::IXMLDOMNodePtr" statement makes the pointer only be usable by typing the namespace (which I do not want)
"using namespace MSXML2" gives an error (which is confirmed in MSDN), so I cannot use that one.
Does anyone have a suggestion on how to use MSXML3 without problems?
-
March 9th, 2006, 07:55 AM
#2
Re: Error importing msxml3.dll
Originally Posted by Arthur
"using namespace MSXML2" gives an error (which is confirmed in MSDN), so I cannot use that one.
What says that error "which is confirmed in MSDN"?
-
March 9th, 2006, 08:00 AM
#3
Re: Error importing msxml3.dll
Originally Posted by Arthur
Note that eliminating the "using MSXML2::IXMLDOMNodePtr" statement makes the pointer only be usable by typing the namespace (which I do not want)
Why don't you want this?
It is not only more readable, but it also solves your problem.
However, if you still find using namespaces with every object-type a nuisance, a solution would be to typedefine your own type.
Like this -
Code:
typedef MSXML2::IXMLDOMNodePtr DOMPTR;
...And use it -
-
March 9th, 2006, 01:01 PM
#4
Re: Error importing msxml3.dll
However, if you still find using namespaces with every object-type a nuisance, a solution would be to typedefine your own type.
Like this -
Or importing the entire namespace:
Code:
#import <msxml3.dll>
using MSXML2;
-
March 9th, 2006, 01:10 PM
#5
Re: Error importing msxml3.dll
I think Cilu means this -
Code:
using namespace MSXML2;
...Which doesn't seem to help this particular case (refer OP).
Last edited by Siddhartha; March 9th, 2006 at 01:12 PM.
-
March 9th, 2006, 02:21 PM
#6
Re: Error importing msxml3.dll
I think Cilu means this -
Doh...
Originally Posted by Arthur
"using namespace MSXML2" gives an error (which is confirmed in MSDN), so I cannot use that one.
And what error is that? I can use it without problems.
-
March 9th, 2006, 02:27 PM
#7
Re: Error importing msxml3.dll
OK. I got it: PSS ID Number: 316317
CAUSE
The "ambiguous symbol" error occurs when a smart pointer interface definition such as IXMLDOMDocumentPtr is defined in both the MSXML2 namespace (through #import) and the global namespace (through Msxml.h), so that the symbol is ambiguous. When the compiler resolves the interfaces, the compiler looks first in Msxml.h, which has different signatures than those that #import generates.
RESOLUTION
To resolve this problem, use the "typelib" namespace with MSXML parser DLLs to prefix the interface pointers and globally unique identifiers (GUIDs).
STATUS
This behavior is by design.
-
April 7th, 2006, 02:22 PM
#8
Re: Error importing msxml3.dll
Correct, that was the MSDN topic, thanx!
I guess I'll just have to prefix it with MSXML2::
To Siddharta:
It is not only more readable, but it also solves your problem.
With the second I agree, with the first I don't. I regularly use small namespaced classes in which I prefer not to refer to other namespaces again and again, but rather use the 'using' statement. Just to keep small lines of code, easy to read.
But that's only a matter of taste and what kind of coding standard you use in your project of course.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|