Need help getting past a VC++7 compiler error
-
Hi I'm developing an application which interfaces with Internet Explorer using COM. I have a problem compiling my code due to typedef redefinitions. Whilst I understand the cause of the compiler error, I cannot figure a way around it. My application is #import'ing mshtml.tlb. This causes the compiler to automatically create 'mshtml.tlh', which redefines some existing typedefs. The worst thing, is that mshtml.tlh (which is not editable due it being regenerated every time you compile) defines UINT_PTR as an unsigned long *, so it differs with the existing definition which is of course unsigned int *. None of these typedefs are mine, and i do not sepcifically include BaseTsd.h or WinGDI.h I could really use some suggestions as to how i can resolve this problem. Here's the output : TestIEConnectWithCOM.cpp c:\TestIEConnectWithCOM\Debug\mshtml.tlh(957) : error C2371: 'UINT_PTR' : redefinition; different basic types c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\BaseTsd.h(90) : see declaration of 'UINT_PTR' c:\TestIEConnectWithCOM\Debug\mshtml.tlh(76516) : error C2011: 'tagLOGFONTW' : 'struct' type redefinition c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinGDI.h(1167) : see declaration of 'tagLOGFONTW' Jase
-
Hi I'm developing an application which interfaces with Internet Explorer using COM. I have a problem compiling my code due to typedef redefinitions. Whilst I understand the cause of the compiler error, I cannot figure a way around it. My application is #import'ing mshtml.tlb. This causes the compiler to automatically create 'mshtml.tlh', which redefines some existing typedefs. The worst thing, is that mshtml.tlh (which is not editable due it being regenerated every time you compile) defines UINT_PTR as an unsigned long *, so it differs with the existing definition which is of course unsigned int *. None of these typedefs are mine, and i do not sepcifically include BaseTsd.h or WinGDI.h I could really use some suggestions as to how i can resolve this problem. Here's the output : TestIEConnectWithCOM.cpp c:\TestIEConnectWithCOM\Debug\mshtml.tlh(957) : error C2371: 'UINT_PTR' : redefinition; different basic types c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\BaseTsd.h(90) : see declaration of 'UINT_PTR' c:\TestIEConnectWithCOM\Debug\mshtml.tlh(76516) : error C2011: 'tagLOGFONTW' : 'struct' type redefinition c:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinGDI.h(1167) : see declaration of 'tagLOGFONTW' Jase
-
Thanks for your reply. The article you linked me too has helped me fix the problem. I'm not well acquainted with namespace's, and the article showed me you can exclude symbols as follows :
#import < mshtml.tlb > named_guids no_namespace exclude("UINT_PTR", "tagLOGFONTW") // Internet Explorer 5
Thanks again for you help. Jase