Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Converting very old VC++ to VS2005 and MSXML

Converting very old VC++ to VS2005 and MSXML

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpcsharpvisual-studiocom
14 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G gartnerj

    Folks, I have a project I'm trying to convert from VC++ MFC to VS2005, and I'm having a problem with msxml (and I know NOTHING about MFC -- have never coded in it). Basically, there is an msxml.cpp/.h in the project directory, and when I compile, I am getting type redefintion errors.

    MSXML.cpp
    e:\....\graphing\mpactgrafx activex control\msxml.h(972) :
    error C2011: 'XMLDOMDocumentEvents' : 'struct' type redefinition
    c:\program files\microsoft visual studio 8\vc\platformsdk\include\msxml.h(9495) : see declaration of 'XMLDOMDocumentEvents'

    in the PROJECT msxml.h:

    class XMLDOMDocumentEvents : public COleDispatchDriver

    and in the platformsdk\Include\msxml.h:

    XMLDOMDocumentEvents : public IDispatch

    Looks like it is pulling in not only the local msxml (which is what I want it to use), but also the c:\program files\Microsoft Visual Studio 8\VC\PlatformSDK\include\msXml.h so I am getting the redef in the project msxml stuff. I don't see any real way to EXCLUDE only that platformSDK\Include\msxml.h file during compilation. I've tried the tools->options->project..-> VC++ directories, but if I exclude that platformSDK\include, I get all sorts of badness happening. If I get rid of the local msxml.h/cpp, I also get bad things happening (due to used objects from that old msxml missing) Any help greatly appreciated.

    S Offline
    S Offline
    Stuart Dootson
    wrote on last edited by
    #2

    Add your local directory to the C++->General->Additional Include Directories property (Debug AND Release). That should mean the compiler sees your local msxml.h before (and instead of) the Platform SDK one. Or, change the msxml #includes to

    #include "./msxml.h"

    I think that might work as well?

    Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

    G 1 Reply Last reply
    0
    • S Stuart Dootson

      Add your local directory to the C++->General->Additional Include Directories property (Debug AND Release). That should mean the compiler sees your local msxml.h before (and instead of) the Platform SDK one. Or, change the msxml #includes to

      #include "./msxml.h"

      I think that might work as well?

      Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

      G Offline
      G Offline
      gartnerj
      wrote on last edited by
      #3

      Thanks -- actually DID include the local dir to resolve a few other issues -- this one is the only one I have left outstanding at the moment (at least until THIS one clears and the compilation finds something else :wtf: ) I have tried the "./msxml.h" also, but I am still getting that error message (I even put in the entire path, same result).

      S 1 Reply Last reply
      0
      • G gartnerj

        Thanks -- actually DID include the local dir to resolve a few other issues -- this one is the only one I have left outstanding at the moment (at least until THIS one clears and the compilation finds something else :wtf: ) I have tried the "./msxml.h" also, but I am still getting that error message (I even put in the entire path, same result).

        S Offline
        S Offline
        Stuart Dootson
        wrote on last edited by
        #4

        gartnerj wrote:

        I have tried the "./msxml.h" also, but I am still getting that error message (I even put in the entire path, same result).

        Well, that's spooky. Have you changed ALL #includes of msxml.h? Try checking stdafx.h and rebuilding from scratch.

        Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

        G 1 Reply Last reply
        0
        • S Stuart Dootson

          gartnerj wrote:

          I have tried the "./msxml.h" also, but I am still getting that error message (I even put in the entire path, same result).

          Well, that's spooky. Have you changed ALL #includes of msxml.h? Try checking stdafx.h and rebuilding from scratch.

          Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

          G Offline
          G Offline
          gartnerj
          wrote on last edited by
          #5

          Yeah, really strange. There are only two references to #include "msxml.h" in the project: 1)a generated MSXML.cpp file 2)a DataParse.h (which is where a bunch of custom parsing code is defined). No other #include of msxml.h at all!!:confused:

          L 1 Reply Last reply
          0
          • G gartnerj

            Yeah, really strange. There are only two references to #include "msxml.h" in the project: 1)a generated MSXML.cpp file 2)a DataParse.h (which is where a bunch of custom parsing code is defined). No other #include of msxml.h at all!!:confused:

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #6

            Add or make sure the following is in your stdafx.h#ifndef VC_EXTRALEAN #define VC_EXTRALEAN #endif
            How to use VC_EXTRALEAN and WIN32_LEAN_AND_MEAN to enhance the build process in Visual C++[^] Let me know if this works. Best Wishes, -David Delaune

            G 1 Reply Last reply
            0
            • L Lost User

              Add or make sure the following is in your stdafx.h#ifndef VC_EXTRALEAN #define VC_EXTRALEAN #endif
              How to use VC_EXTRALEAN and WIN32_LEAN_AND_MEAN to enhance the build process in Visual C++[^] Let me know if this works. Best Wishes, -David Delaune

              G Offline
              G Offline
              gartnerj
              wrote on last edited by
              #7

              Thanks David, I had seen the WIN_LEAN_AND_MEAN setting and had tried that with no luck. I tried the VC_EXTRALEAN, and I still get the errors:

              DataParse.cpp
              e:\....\graphing\mpactgrafx activex control\msxml.h(977) :
              error C2011: 'XMLDOMDocumentEvents' :
              'struct' type redefinition
              c:\program files\microsoft visual studio 8\vc\platformsdk\include\msxml.h(9495) :
              see declaration of 'XMLDOMDocumentEvents'
              MSXML.cpp
              e:\....\graphing\mpactgrafx activex control\msxml.h(977) :
              error C2011: 'XMLDOMDocumentEvents' :
              'struct' type redefinition
              c:\program files\microsoft visual studio 8\vc\platformsdk\include\msxml.h(9495) : see declaration of 'XMLDOMDocumentEvents'

              No joy yet.

              G L S 3 Replies Last reply
              0
              • G gartnerj

                Thanks David, I had seen the WIN_LEAN_AND_MEAN setting and had tried that with no luck. I tried the VC_EXTRALEAN, and I still get the errors:

                DataParse.cpp
                e:\....\graphing\mpactgrafx activex control\msxml.h(977) :
                error C2011: 'XMLDOMDocumentEvents' :
                'struct' type redefinition
                c:\program files\microsoft visual studio 8\vc\platformsdk\include\msxml.h(9495) :
                see declaration of 'XMLDOMDocumentEvents'
                MSXML.cpp
                e:\....\graphing\mpactgrafx activex control\msxml.h(977) :
                error C2011: 'XMLDOMDocumentEvents' :
                'struct' type redefinition
                c:\program files\microsoft visual studio 8\vc\platformsdk\include\msxml.h(9495) : see declaration of 'XMLDOMDocumentEvents'

                No joy yet.

                G Offline
                G Offline
                gartnerj
                wrote on last edited by
                #8

                Actually, looking in the code, the stdafx.h file HAS the define for VC_extralean - must have done that during the conversion up to VS2005!

                1 Reply Last reply
                0
                • G gartnerj

                  Thanks David, I had seen the WIN_LEAN_AND_MEAN setting and had tried that with no luck. I tried the VC_EXTRALEAN, and I still get the errors:

                  DataParse.cpp
                  e:\....\graphing\mpactgrafx activex control\msxml.h(977) :
                  error C2011: 'XMLDOMDocumentEvents' :
                  'struct' type redefinition
                  c:\program files\microsoft visual studio 8\vc\platformsdk\include\msxml.h(9495) :
                  see declaration of 'XMLDOMDocumentEvents'
                  MSXML.cpp
                  e:\....\graphing\mpactgrafx activex control\msxml.h(977) :
                  error C2011: 'XMLDOMDocumentEvents' :
                  'struct' type redefinition
                  c:\program files\microsoft visual studio 8\vc\platformsdk\include\msxml.h(9495) : see declaration of 'XMLDOMDocumentEvents'

                  No joy yet.

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #9

                  :(( Ok, lets be patient and work through this. First thing you need to do is find out where msxml.h is being included. Do you have #include <urlmon.h> included anywhere? Best Wishes, -David Delaune

                  S G 2 Replies Last reply
                  0
                  • L Lost User

                    :(( Ok, lets be patient and work through this. First thing you need to do is find out where msxml.h is being included. Do you have #include <urlmon.h> included anywhere? Best Wishes, -David Delaune

                    S Offline
                    S Offline
                    Stuart Dootson
                    wrote on last edited by
                    #10

                    Windows.h #includes Ole2.h which #includes ObjBase.h which #includes urlmon.h No way round getting the SDKs msxml.h, as far as I can tell.

                    Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

                    1 Reply Last reply
                    0
                    • G gartnerj

                      Thanks David, I had seen the WIN_LEAN_AND_MEAN setting and had tried that with no luck. I tried the VC_EXTRALEAN, and I still get the errors:

                      DataParse.cpp
                      e:\....\graphing\mpactgrafx activex control\msxml.h(977) :
                      error C2011: 'XMLDOMDocumentEvents' :
                      'struct' type redefinition
                      c:\program files\microsoft visual studio 8\vc\platformsdk\include\msxml.h(9495) :
                      see declaration of 'XMLDOMDocumentEvents'
                      MSXML.cpp
                      e:\....\graphing\mpactgrafx activex control\msxml.h(977) :
                      error C2011: 'XMLDOMDocumentEvents' :
                      'struct' type redefinition
                      c:\program files\microsoft visual studio 8\vc\platformsdk\include\msxml.h(9495) : see declaration of 'XMLDOMDocumentEvents'

                      No joy yet.

                      S Offline
                      S Offline
                      Stuart Dootson
                      wrote on last edited by
                      #11

                      A suggestion. Stuff your local msxml.h inside a namespace when #including it:

                      namespace Old
                      {
                      #include "msxml.h"
                      }

                      and then explicitly specify the namespace when using the structures out of your local file - e.g.

                      Old::XMLDOMDocumentEvents events;

                      Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

                      G 2 Replies Last reply
                      0
                      • L Lost User

                        :(( Ok, lets be patient and work through this. First thing you need to do is find out where msxml.h is being included. Do you have #include <urlmon.h> included anywhere? Best Wishes, -David Delaune

                        G Offline
                        G Offline
                        gartnerj
                        wrote on last edited by
                        #12

                        Just checked, and NO, no ulrmon.h in any of the project files.

                        1 Reply Last reply
                        0
                        • S Stuart Dootson

                          A suggestion. Stuff your local msxml.h inside a namespace when #including it:

                          namespace Old
                          {
                          #include "msxml.h"
                          }

                          and then explicitly specify the namespace when using the structures out of your local file - e.g.

                          Old::XMLDOMDocumentEvents events;

                          Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

                          G Offline
                          G Offline
                          gartnerj
                          wrote on last edited by
                          #13

                          I'll have to give that a try -- will try to get to it later this morning -- working on a different project at the moment!

                          1 Reply Last reply
                          0
                          • S Stuart Dootson

                            A suggestion. Stuff your local msxml.h inside a namespace when #including it:

                            namespace Old
                            {
                            #include "msxml.h"
                            }

                            and then explicitly specify the namespace when using the structures out of your local file - e.g.

                            Old::XMLDOMDocumentEvents events;

                            Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

                            G Offline
                            G Offline
                            gartnerj
                            wrote on last edited by
                            #14

                            Stuart -- thanks. Using the namespace seems to have worked (at least, it got rid of the compilation errors and let me build the project). Thanks folks for all of the help!!! :-D

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups