How does Visual Studio determine the order to compile IDL files?
I have a COM project that contains a number of IDL files, some of which are imported into other ones. How does开发者_Go百科 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).
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
).
You can make Visual Studio build things in any order you want, there are 2 ways to do this:
Put in a pre-build step in which you can get it to build the ones you wish to build first.
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.
精彩评论