Question

I have a COM project that contains a number of IDL files, some of which are imported into other ones. How does Visual Studio decide which ones to compile (using MIDL) first?

I want to control the order. I have a master IDL file which contains my library declaration with several imports, and I get a build error if it is not the first one compiled.

(If any of this sounds really weird... I'm new to COM/ATL, and it's really, really confusing).

Was it helpful?

Solution

You can't ask Visual Studio to build .ild files in a specific order. Instead you can #include some of .idl files into other .idl files and set the files you imported to "excluded from build". This way MIDL will not compile the imported files separately, instead it will include their contents into specific place of another file and compile as the part of that file (same effect as with C preprocesor #include).

OTHER TIPS

You can make Visual Studio build things in any order you want, there are 2 ways to do this:

  1. Put in a pre-build step in which you can get it to build the ones you wish to build first.

  2. Put the ones you want to build first in a separate project and get it to build that project first by making your other one dependent on it.

This is what you should do if you cannot modify the idl files. If however one idl file really does depend on another and you can modify them, then do what was suggested above and get one to include the other.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top