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