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. Need help getting past a VC++7 compiler error

Need help getting past a VC++7 compiler error

Scheduled Pinned Locked Moved C / C++ / MFC
helpcsharpc++comvisual-studio
3 Posts 2 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.
  • J Offline
    J Offline
    Jase Jennings
    wrote on last edited by
    #1

    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

    S 1 Reply Last reply
    0
    • J Jase Jennings

      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

      S Offline
      S Offline
      Stephane Rodriguez
      wrote on last edited by
      #2

      I believe you can provide a different namespace name, to avoid the conflict. More info here[^].

      J 1 Reply Last reply
      0
      • S Stephane Rodriguez

        I believe you can provide a different namespace name, to avoid the conflict. More info here[^].

        J Offline
        J Offline
        Jase Jennings
        wrote on last edited by
        #3

        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

        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