Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Including a .idl file in a C++ project

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?

like image 272
wyatt Avatar asked Jul 25 '11 04:07

wyatt


People also ask

How do I add a CPP file to a project?

Add a new source file to the project, as follows. In Solution Explorer, right-click the Source Files folder, point to Add, and then click New Item. In the Code node, click C++ File (. cpp), type a name for the file, and then click Add.

What is a .IDL file?

A file that contains interface and type library definitions is called an IDL file, and has a . idl file name extension. The Interface Definition Language (IDL) is not a programming language, but a descriptive language to describe the interfaces being implemented by objects. IDL files are similar to C++ header files.

Where is the MIDL compiler?

The MIDL compiler is automatically installed as part of the Platform Software Development Kit (SDK) setup.

What is IDL compiler?

The IDL compiler defines preprocessor macros specific to the platform. All macros predefined by the preprocessor that you are using can be used in the OMG IDL file, in addition to the user-defined macros. You can also define your own macros when you are compiling or loading OMG IDL files.


1 Answers

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.

like image 89
Sasha Avatar answered Sep 22 '22 19:09

Sasha