#使用Visual Studio 2010导入 [英] #import with visual studio 2010
问题描述
你好,
我有Visual Studio2010.
我的Thirdpart目录中有一个.tlb文件,我想导入它.
我查看了另一个项目,它的导入方式如下:
#import"mytlb.tlb" no_namespace named_guids raw_interfaces_only
并且可以在其他项目中很好地编译.
在我的项目中,当我添加此#import行时,编译失败,并且出现以下错误:
错误C2220:警告被视为错误-未生成对象"文件
可能是什么原因?我应该怎么做才能使其正常编译?
谢谢
Hello,
I have visual studio 2010.
I have a .tlb file in my Thirdpart directory, and I want to import it.
I looked on another project, and it''s imported like this:
#import "mytlb.tlb" no_namespace named_guids raw_interfaces_only
and it compiles fine in other prjects.
In my project, when I add this #import line, compile fails and I get the following error:
error C2220: warning treated as error - no ''object'' file generated
What can be the reason? What should I do to make it compile fine?
Thanks
推荐答案
尝试通过properties-> add->将.tlb添加到您的项目中.添加现有的,然后选择它.不要删除#import并尝试编译
try adding .tlb into your project by properties->add-> add existing then choose it. dont remove #import and try to compile
这篇关于#使用Visual Studio 2010导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!