none
exclude msxml.h

    Question

  • I have ported a VC++6.0 project into Visual Studio 2008. It uses xerces parser. I do not include msxml.h but still get the the error "error C2371: 'DOMDocument' : redefinition; different basic types c:\program files\microsoft sdks\windows\v6.0a\include\msxml.h 7964". Kindly inform how to exclude msxml.h from the project so that it complies successfully.

    Wednesday, January 06, 2010 6:21 AM

Answers

All replies

  • Please note: I have already tried using VC_EXTRALEAN and WIN_LEAN_AND_MEAN in stdafx.h but with no success. Also I have tried changing the include directory paths resulting in other errors like "cannot open windows.h". To debug this error, I have to include the directory path where msxml.h also exists.

    DO HELP.

    Thank you
    Wednesday, January 06, 2010 6:25 AM
  • Hi Neealive,

    Found this hint from here - Xerces: MSXML.H - Redefinition of DOMDocument Basetype VS 2008

    "msxml.h is included deep in ole2.h; the only way to fix this is to add a
    #undef DOMDocument before including the Xerces headers."


    Best Regards,
    Jijo.

    http://weseetips.com[^] Visual C++ tips and tricks. Updated daily.
    • Marked as answer by Wesley Yao Wednesday, January 13, 2010 3:23 AM
    Wednesday, January 06, 2010 7:31 AM
  • Hi Neealive,

    Try to define WIN32_LEAN_AND_MEAN. Or try to add namespace qualified such as xercesc_3_0::DOMDocument.

    Best Regards,
    Nancy
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Wesley Yao Wednesday, January 13, 2010 3:23 AM
    Friday, January 08, 2010 6:26 AM
  • I have already used #undef DOMDocument, also WIN32_LEAN_AND_MEAN. None of these helped
    Wednesday, January 13, 2010 11:16 AM
  • I commented the lines in msxml.h which declare DOMDocument. This lead to numerous errors in xlocale and xdebug which is weird as these are windows header files. Errors are:-

    Error 162 error C2039: '_Catmask' : is not a member of 'std::_Locimp' d:\program files\microsoft visual studio 9.0\vc\include\xlocale 220
    Error 99 error C2059: syntax error : ')' d:\program files\microsoft visual studio 9.0\vc\include\xdebug 33

    and many more...

    Any help is appreciated.

    Thanks
    Friday, January 15, 2010 4:32 AM
  • Hello, I don't know if you solved this already or not, but I have encountered exactly the same problem today.

    WIN32_LEAN_AND_MEAN, VC_EXTRALEAN, using namespace qualified access to DOMDocument, none of them worked.

     

    But after banging  my head for 3 hours, finally defining __MSXML_LIBRARY_DEFINED__ in stdafx.h helped my day.

    You can add something like this wherever the compiler looks first.

     

    #ifndef __MSXML_LIBRARY_DEFINED__
    #define __MSXML_LIBRARY_DEFINED__
    #endif

     

    Hope this helps.

    • Proposed as answer by mooogie Sunday, March 06, 2011 9:22 AM
    Sunday, March 06, 2011 9:11 AM