在C ++项目中包含.idl文件

时间:2011-07-25 04:17:35

标签: c++ visual-studio-2010 directshow idl

我正在用C ++构建一个项目,该项目使用DirectShow的视频捕获库连接到摄像机。视频卡制造商(BlackMagic)提供了.idl(接口定义语言)文件,可将新的捕获图形添加到标准集合中。

事情是,我从未遇到过.idl文件,而且非常模糊的“包含文件”方向并没有多大帮助。用#include指令包含它不会引起任何错误,但程序也无法引入我想要添加的各种定义,因为它是我被告知要包含在项目中的唯一文件。 / p>

我的问题是:如何在项目中包含.idl文件?

1 个答案:

答案 0 :(得分:19)

For example: you have an AFileName.idl
1. Add the AFileName.idl to you project: Right Click on The project->Add->Existing Item...
2. Click Right on The AFileName.idl from the project->Compile
3. The step 2 will generate AFileName_h.h, AFileName_i.c, AFileName_p.c,...
4. Now you can #include "AFileName_h.h" and use it, you also may need 
   to add AFileName_i.c or other generated files to your project  
   depending on your needs.

观察:VS2008描述了这些步骤,但我不认为VS2010在这方面有所不同。