error MIDL2398: cannot execute MIDL engine RRS feed

  • Question

  • I have the following error when I compile my c++ project (visual studio 2012).

    1>Project "C:\DevSource\ImgDepot\Dlls\ArchiveAPI\ArchiveAPI.vcxproj" on node 2 (Rebuild target(s)).
             C:\Program Files (x86)\Windows Kits\8.0\bin\x86\midl.exe /W1 /nologo /char signed /env win32 /Oicf /h "ArchiveAPI.h" /iid "ArchiveAPI_i.c" /tlb ".\ArchiveAPI.tlb" ArchiveAPI.idl
         1>midl : error MIDL2398: cannot execute MIDL engine
         1>Done Building Project "C:\DevSource\ImgDepot\Dlls\ArchiveAPI\ArchiveAPI.vcxproj" (Rebuild target(s)) -- FAILED.

    This error is caused by a condition in my laptop. There is a file "program" (no extension, and it is a file not a folder) in root of my c drive. I was able to compile this project before this file was added to the c drive by error. I have spending a lot of time trying to delete or rename this file but all failed. It always throw out access denied error even though my login account is the local administrator. This makes me to believe that the only way to remove this file is to reinstall windows, and to spend weeks to reconfigure my development environment (a big pain).

    I wonder if there is a way to make the midl command work with this program file in the root of my c drive.

    Monday, November 21, 2016 3:32 PM

All replies

  • Have you tried deleting the file from an elevated command prompt?

    You could also download one of the many available Live CD/DVD distributions of Linux (e.g., Knoppix), so that you could run Linux and delete the file from the root of the C drive while Windows wasn't running.

    Monday, November 21, 2016 5:39 PM
  • Thanks for the reply. The elevated command prompt does not work. It still results in access denied. I have also tried to change the owner of the file. But it returned the same "access denied" message. I have boot into safe mode but same result.

    I am not sure if the Linux approach work or not. This c drive is encrypted. My gut feeling tells me that Linux cannot read the encrypted drive.

    • Edited by WMRocks Tuesday, November 22, 2016 1:21 PM
    Monday, November 21, 2016 6:00 PM
  • Since its a work laptop with an encrypted drive I suggest you bring the issue to the people within the company that handle such IT issues.

    You could also try going to the Security Tab of the rogue file's property page.  Use your administrator privilege to take ownership of the file and grant yourself "Full Control".  Then you should be able to delete the file.

    • Edited by RLWA32 Monday, November 21, 2016 7:38 PM
    Monday, November 21, 2016 6:47 PM
  • If I cannot resolve this issue, I have windows reinstalled. I have to bite the bullet and spend weeks to configure all the development environment. This is something that I try to avoid.

    Changing the ownership of the file always returns access denied, as I mentioned it in the original message.

    Any way I can run the MIDL command?

    • Edited by WMRocks Tuesday, November 22, 2016 1:23 PM
    Monday, November 21, 2016 7:45 PM
  • use the SysInternals tool handles.exe (or something close to that) to look at what open handles are on that file, then kill them (the process that has them open) and then delete the file. 

    • Edited by Joel_Z Monday, November 21, 2016 8:09 PM
    Monday, November 21, 2016 8:04 PM
  • It might be helpful if we could see the access control list of the rogue file.  You should be able to use icacls.exe to display the file's DACL.

    Monday, November 21, 2016 8:11 PM
  • Thanks for your reply. I have run the icacls.exe. This is the result. 



    Monday, November 21, 2016 8:28 PM
  • Double check you are an admin. If you are on a domain, disjoin the domain, reboot then login as the local admin (you may need to enable it first). Then try to delete or take ownership and delete.
    Monday, November 21, 2016 8:37 PM
  • It looks like BUILTIN\Adminstrators already have full control. 

    Have you checked to see if the file has a read-only or system attribute set?
    • Edited by RLWA32 Monday, November 21, 2016 8:59 PM
    Monday, November 21, 2016 8:57 PM
  • The file is not read-only. There is no system attribute set.
    Monday, November 21, 2016 9:15 PM
  • Use task scheduler to run a task under the SYSTEM account.  Setup the task to run cmd.exe and pass cmd.exe the command to delete the file as a command line parameter.

    I'm assuming that you've already determined that no programs are holding the file open.

    • Edited by RLWA32 Monday, November 21, 2016 9:55 PM
    Monday, November 21, 2016 9:47 PM
  • I have used process explorer to make sure that no process is locking this file. I then set up a schedule task and put in the bat file in the action as follow

    del c:\program

    I then set up the task with the System user and check the box "run with highest privileges". The schedule task reported successful but the file is still in the c drive.

    Any other way I can try.

    Tuesday, November 22, 2016 12:54 AM
  • I don't know how you set up your task, but the one that worked perfectly on my system looked like this -

    Are you sure it's really a file?  what does dir c:\ /a show?

    If you can't get this to work I'm all out of suggestions.

    • Edited by RLWA32 Tuesday, November 22, 2016 3:59 AM
    Tuesday, November 22, 2016 3:52 AM
  • Thanks for your reply again. I made sure that the command followed your pattern. But unfortunately it was still not working. But that is Ok. I will have windows reinstalled.

    Thanks all for your help.

    • Edited by WMRocks Tuesday, November 22, 2016 1:20 PM
    Tuesday, November 22, 2016 4:37 AM
  • Check this solution to similar issue and see if it helps:

    MIDL2398 error building with Visual Studio 2010 on Windows 2012

    Try renaming, by System/IT Admin if not possible before trying OS reinstall.

    Thanks & Regards

    Tuesday, November 22, 2016 3:10 PM