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. COM
  4. error C4772: #import referenced a type from a missing type library

error C4772: #import referenced a type from a missing type library

Scheduled Pinned Locked Moved COM
helpcomtutorialquestion
4 Posts 2 Posters 13 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.
  • S Offline
    S Offline
    samfromcn
    wrote on last edited by
    #1

    I have an interface, I1 declared in library A, another interface I2 in library B. I2 has a property whose type is I1. Now I want to use I2 in project A, so I "#import 'B.tlb' rename_namespace('B'), named_guids", then compile failed with error C4772, for interface I1 that in B.tlh can not be indentified. How to resolve this problem?

    S 1 Reply Last reply
    0
    • S samfromcn

      I have an interface, I1 declared in library A, another interface I2 in library B. I2 has a property whose type is I1. Now I want to use I2 in project A, so I "#import 'B.tlb' rename_namespace('B'), named_guids", then compile failed with error C4772, for interface I1 that in B.tlh can not be indentified. How to resolve this problem?

      S Offline
      S Offline
      Stuart Dootson
      wrote on last edited by
      #2

      Use the auto_search[^] attribute on #import to automatically perform a #import of things B references.

      Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

      S 1 Reply Last reply
      0
      • S Stuart Dootson

        Use the auto_search[^] attribute on #import to automatically perform a #import of things B references.

        Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

        S Offline
        S Offline
        samfromcn
        wrote on last edited by
        #3

        Thanks for your suggestion, but it does not work. Because I have not write code using I2, if I comment the import clause, project A can be compiled well. But if I add import clause, compiled with error C4772.

        S 1 Reply Last reply
        0
        • S samfromcn

          Thanks for your suggestion, but it does not work. Because I have not write code using I2, if I comment the import clause, project A can be compiled well. But if I add import clause, compiled with error C4772.

          S Offline
          S Offline
          Stuart Dootson
          wrote on last edited by
          #4

          Ah, I see - hadn't noticed the circular dependency... Have you tried #including the .h file generated from project A's IDL file before the #import - because that's all you need really - a definition of I1 before the #import statement. You may need to play with #import attributes to get the namespaces correct, but that's about all you should need.

          Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

          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