错误#import引用了缺少类型库中的类型,以导入vc ++项目中的.tlb文件 [英] Error #import referenced a type from a missing type library to import .tlb file in vc++ project

查看:787
本文介绍了错误#import引用了缺少类型库中的类型,以导入vc ++项目中的.tlb文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我们使用的VC ++项目,C#dll作为com组件,首先我们将这些c#dll注册到System(在Win-10 64位操作系统上),当我们从.h文件构建vc ++项目时通过.tlb文件导入这些dll以从数据库中获取数据。


在构建vc ++项目时,我们收到错误"#import从缺少的类型库引用了一个类型; '__missing_type__'用作占位符"。相同的源代码正在与其他系统一起使用。我们经常遇到这些错误。


很多时候解决这些错误,我们清理并重建项目但没有运气。


请帮帮我对于这些问题。


欢迎所有建议!!!



解决方案

¥b $ b


感谢您在此发布。


我建议您根据
这个文件



A型库使用#import指令引用。但是,类型库包含对未使用#import引用的另一个类型库的引用。编译器找不到此其他.tlb文件。

请注意,如果使用/ I(Additional Include Directories)编译器选项指定这些目录,编译器将不会在不同目录中找到类型库。如果希望编译器在不同目录中查找类型库,请将这些
目录添加到PATH环境变量。

默认情况下,此警告将作为错误发出。使用/ W0无法抑制C4772。


如果这对您无法解决,请随时与我们联系。


最好的祝福,


Jack Zhang


For VC++ Project we are using ,C# dll as com components, First we register these c# dll to System (on Win-10 64-bit OS), when we build the vc++ Project , from .h file we import these dll's through the .tlb files to fetch the data from database.

While building the vc++ project we are getting error "#import referenced a type from a missing type library; '__missing_type__' used as a placeholder". Same source code is working with other system. Frequently we are getting these errors.

Many time to resolved these error , we clean and rebuild the project but no luck.

Please help me out for these problem.

All Suggestions are welcome !!!

解决方案

Hi,

Thanks for posting here.

I suggest you check your code again according to this document.

A type library was referenced with the #import directive. However, the type library contained a reference to another type library that was not referenced with #import. This other .tlb file was not found by the compiler.
Note that the compiler will not find type libraries in different directories if you use the /I (Additional Include Directories) compiler option to specify those directories. If you want the compiler to find type libraries in different directories, add those directories to the PATH environment variable.
By default this warning is issued as an error. C4772 cannot be suppressed with /W0.

If this can't help you, please feel free to contact us.

Best Wishes,

Jack Zhang


这篇关于错误#import引用了缺少类型库中的类型,以导入vc ++项目中的.tlb文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆