I am changing my C++ project, which was earlier in VC6 and now being migrated to VS 2008, to use MSXML 6 instead of the earlier MSXML 3. When the code was in VC6 we were using MSXML3 by importing it
# import "msxml3.dll"
This was replaced with
# import "msxml6.dll"
After this when I compile the project I get this and several other similar errors Error C2011: 'MSXML2::IXMLDOMImplementation' : 'struct' type redefinition
The above error is in the msxml3.tlh file.
1) Why is msxml3 still being used?
2) I narrowed down the problem to MSXML.h which is somehow automatically being included in my project. Why is this?
3) Which version of MSXML is being referenced in MSXML.h?
4) Why in the world does VC++ automatically include so many header files? What if I dont want some header files to be included?
5) What is the right way of using MSXML6 in a c++ project? #import, header file?????
6) How do I fix this problem?
Give me .net any time. Much cleaner. A VC++ project is a mess.
Check the syntax of the #import directive. You can rename imported elements using rename attribute on import directive (or rename_namespace). It will resolve conflicts with duplicated elements.
See here: in MSDN
Sometimes change of the inclusion order (yes - try different order of the include and import statements by commenting them out)
Don't fight with the MS mistakes, just cross them ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With