REQUEST A DEMO

Correcting a MIDL compiler error – MIDL1001 : cannot open input file

This post is for me or for any of the poor souls out there still doing COM development and using the MIDL compiler in anger. Every now and again I need to get our build automation working with the MIDL compiler and it always seems to be related to some sort of path issue. I ran into this again today on my new development machine and in frustration am creating this post so I can remind myself what I did to fix it.

 

midl : command line error MIDL1001 : cannot open input file oaidl.idl

 

We have a step in our build automation where we generate a type library using midl.exe. Usually when you are using the Visual Studio Command Prompt (vcvars32.bat) this will work fine but something seems to have gone wrong with this on my Windows 7 development machine on which I’ve also installed the Visual 2010 release candidate which may be to blame in this situation.

 

The answer lies in the registry setting for the Windows SDK.

 

Registry Settings for the Windows SDK (pointing at v6.0a)

 

vcvars32.bat is looking in the registry setting above to find the path the the Windows SDK. On my machine there is no MIDL compiler (midl.exe) under this directory.

 

Corrected registry setting pointing to the directory where the midl compiler exists.

 

The solution is to point the CurrentInstallFolder entry to the v7.0A Windows SDK installation folder. While I was there I updated the CurrentVersion and the ProductVersion entries just in case that mattered to anyone else.

 

You’ll need to open another Visual Studio 2008 command prompt to have the build environment paths setup correctly. I sure hope this helps if you too ran into this. And Kevin (looking good by the way) if you run into this again remember to look for this blog post!

Comments

ADD COMMENT

Your email address will not be published.