17

I'm building a project in C++ which uses DirectShow's video capture library to connect to a camera. The video card manufacturer (BlackMagic) has provided .idl (Interface Definition Language) files which add new capture graphs to the standard collection.

Thing is, I've never come across a .idl file, and the very vague "include the file" direction doesn't help much. Including it with a #include directive doesn't throw up any errors, but the program also fails to pull in the various definitions which I presume it's intended to add, since it's the only file I'm told to include with the project.

My question is: how should one include a .idl file in a project?

wyatt
  • 3,188
  • 10
  • 36
  • 48
  • Most likely you don't need to include the .IDL into your project, or there is an easier and/or better way to achieve whatever you are trying to achieve. – Roman R. Nov 11 '14 at 19:33

1 Answers1

21
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.

Observation: the steps are described for VS2008 but I don't think VS2010 is different in that perspective.

Sasha
  • 846
  • 5
  • 9
  • 7
    If you do add a .c file to your project you'll probably also have to change the file's C/C++ | Advanced | "Compile As" property to "Compile as C Code (/TC)" and may also have to set the file's C/C++ | Precompiled Headers | "Precompiled header" property to "Not using precompiled headers" – Frank Boyne Jul 25 '11 at 05:01