Error C2227 when compiling with XML Support
Posted on 2007-10-12
I have inherited a Visual C++ application. I am using Visual Studio 2005. It is *not* a .NET app. Whenever I compile I get 3 errors that read thus:
Error 476 error C2227: left of '->QueryInterface' must point to class/struct/union/generic type C:\Program Files\Microsoft Visual Studio 8\VC\include\comip.h 852
I have three lines that make a call like this in various placess:
::IXMLDOMDocumentPtr pXMLDoc = (MSXML2::IXMLDOMDocumentPtr)GetDocument();
If I comment out the "(MSXML2::IXMLDOMDocumentPtr)GetDocument();" it compiles fine. Of course, pXMLDoc is then not initialized. Now, this GetDocument() function signature is like:
Even if I comment out all of the code in that function and then just make it "return 0;" I still get the error.
Now, if you look at that original error it is in comip.h. That apparently is a standard include file. I have not modified that include file, it is stock. I don't know why there would be any problem with it. Googling this yields very little. The best I can come up with is that there is a mismatch in some kind of include file set between the SDK and the VS standard include set.
At the top of the file I have
I also include a msxml.h which appears to have been generated, of course. This is the beginning of that file
// Created by Microsoft (R) C/C++ Compiler Version 14.00.50727.42 (67f0d8d7).
// C++ source equivalent of Win32 type library msxml.dll
// compiler-generated file created 10/07/06 at 14:30:45 - DO NOT EDIT!
I don't have that c:\tmp\cacat\.... file. Again this stuff was inherited and there is not anyone else I can talk to about it. It appears all this is just due to the XML stuff. So if anyone can give me the best route to get this solve ASAP I would really really appreciate it. Thanks.