For Programmers: Free Programming Magazines  


Home > Archive > VC Language > May 2006 > MSXML conflicting issues trying to port VC6 project to VC8.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author MSXML conflicting issues trying to port VC6 project to VC8.
murrayh@gmail.com

2006-05-23, 10:05 pm

Hello,

Trying to port a large COM application from VC6 to VC8, but its usage
of MSXML3 is giving me some nasty trouble :(.


The error:

d:\project\common\XMLPropertiesToStringC
onverter.h(24) : error C2872:
'IXMLElement' : ambiguous symbol
could be 'c:\program files\microsoft visual studio
8\vc\platformsdk\include\msxml.h(11382) : IXMLElement'
or 'd:\project\main\debug\msxml3.tlh(1675) :
MSXML2::IXMLElement'


Background information:

* XMLPropertiesToStringConverter.h belongs to a DLL (common.dll)
* common.dll compiles (I did have to add MSXML2:: everywhere though)
* The 'main' project that creates the executable includes
XMLPropertiesToStringConverter.h
* Line 24 of XMLPropertiesToStringConverter.h is "#import <msxml3.dll>"
* I get a heaps of the above error, with each of them pointing to the
line 24 import statement.


Things I've tried:

* Replacing c:\program files\microsoft visual studio
8\vc\platformsdk\include\msxml.h with VC6.0's.
This caused an error in generating 'main's precompiled header,
specifically shobjidl.idl referencing an undefined XML related object.

* "#import <msxml3.dll> rename_namespace("MY_MSXML2")"
No difference


Other:

* 'main' processes "C:\Program Files\Microsoft Visual Studio
8\VC\PlatformSDK\include\msxml.idl" when generating its precompiled
header, which I think has something to do with this.


'main's stdafx.h includes the following headers:

#include <afx.h>
#include <afxdisp.h>
#include <comdef.h>
#include <atlbase.h>
#include <afxmt.h>
#include <winsock2.h>
#include <afxsock.h>
#include <atlcom.h>
#include <Mmsystem.h>


I'm going to keep slugging away and see if I can come dig up something,
but yeah any help would be much appreciated ;).

Cheers,
Murray

William DePalo [MVP VC++]

2006-05-23, 10:05 pm

<murrayh@gmail.com> wrote in message
news:1148437151.116565.301170@y43g2000cwc.googlegroups.com...
> Trying to port a large COM application from VC6 to VC8, but its usage
> of MSXML3 is giving me some nasty trouble :(.
>
>
> The error:
>
> d:\project\common\XMLPropertiesToStringC
onverter.h(24) : error C2872:
> 'IXMLElement' : ambiguous symbol
> could be 'c:\program files\microsoft visual studio
> 8\vc\platformsdk\include\msxml.h(11382) : IXMLElement'
> or 'd:\project\main\debug\msxml3.tlh(1675) :
> MSXML2::IXMLElement'


Does the workaround described here:

http://support.microsoft.com/?id=316317

fix the problem?

If not, just post again.

Regards,
Will


murrayh@gmail.com

2006-05-23, 10:05 pm

If I understand correctly, this article is just talking about prefixing
the MSXML2 namespace to the objects. I did stumble accross this problem
compiling common.dll, and fixed it by applying the scope.

In this case, the ambiguouty appears to be happening *inside* the
#import statement, because every error generated points to the #import
line. To be totally honest, I don't know much about the #import
statement and what it is doing for me, but I do know that I can't
change whatever is in msxml3.dll ;).

William DePalo [MVP VC++]

2006-05-23, 10:05 pm

<murrayh@gmail.com> wrote in message
news:1148440758.476817.105520@j73g2000cwa.googlegroups.com...
> If I understand correctly, this article is just talking about prefixing
> the MSXML2 namespace to the objects. I did stumble accross this problem
> compiling common.dll, and fixed it by applying the scope.


OK. First, I should tell you that I deleted your original message (I read
_too_ many groups to save all the messages that I read - I save only my
replies) so I'm not sure exactly but I think that you have

IXMLElement

in your source where the article says you should edit that line to be

MSXML2::IXMLElement

to qualify it with the proper namespace.

> To be totally honest, I don't know much about the #import
> statement and what it is doing for me, but I do know that I can't
> change whatever is in msxml3.dll ;).


Using #import, the compiler reads the metadata associated with the COM
object (type library in COM parlance) and wraps it with a C++ class so, for
example, the synthesized constructor calls the AddRef() method and the
destructor calls Release().

Regards,
Will


murrayh@gmail.com

2006-05-24, 4:16 am

My problem is these ambiguous IXMLElements are not in my (for
simplicities sake ;) source, but are being apparently generated by
"#import <msxml3.dll>".


'common.dll':
* Has a header file 'XMLPropertiesToStringConverter.h' with the line
#import <msxml3.dll>
* Uses MSXML
* Compiles with no error

'main' module:
* Has a .cpp file that includes 'XMLPropertiesToStringConverter.h'
* Does not use MSXML at all itself
* Generates 100 errors (and cuts out because of limit) about ambiguous
XML objects. Each error points to the #import line in
'XMLPropertiesToStringConverter.h'.


I am of the current belief that the 'main' modules precompiled headers
have something to do with this.

I think I will try to change 'XMLPropertiesToStringConverter.h' such
that it doesn't have to use the #import in the header file, but a less
intrusive solution would still interest me.

Cheers,
Murray

William DePalo [MVP VC++]

2006-05-24, 4:16 am

<murrayh@gmail.com> wrote in message
news:1148443813.939341.271070@j33g2000cwa.googlegroups.com...
> My problem is these ambiguous IXMLElements are not in my (for
> simplicities sake ;) source, but are being apparently generated by
> "#import <msxml3.dll>".


Do you have a short snippet that I can try here?

Regards,
Will


murrayh@gmail.com

2006-05-24, 4:16 am

Hello,

Shifting the #import to the .cpp file solved the problem. Why didn't I
think of this earlier!? Thanks for the help Will!

Cheers,
Murray

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com