4

I've some problem with a project (an OCX): when I try to compile in release mode compilation stops with this message:

"1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(1178,5): error MSB6006: "midl.exe" exited with code 2214."

I cannot find any information useful to debug the error because is not an error code, is an exit code. What I can do? It stops right after start parsing "oaidl.acf".

  • "MIDL2214: semantic check incomplete due to previous errors. The MIDL compiler makes two passes over the input file(s) to resolve any forward declarations. Due to errors encountered during the first pass, checking for the second pass has not been performed. Unreported errors relating to forward declarations may still be present in the file." [source](http://bit.ly/1sr512P) – Carsten Apr 07 '14 at 07:55
  • Ok, but the error is not MIDL2214 is MSB6006. 2214 is the exit code of MIDL. Is the same? BTW even if I assume this is the right explaination of the error, I'm still unable to debug the problem. –  Apr 07 '14 at 07:58
  • MSB6006 get's raised if a subprogram has not executed successfully. In this case MIDL returned an error. The error code of MIDL describes what goes wrong. So the actual error is MIDL2214. It's hard to guess what's the actual reason without more details. If it builds in debug mode, but not in release mode, I guess some library references are missing or something within the build configuration is wrong. – Carsten Apr 07 '14 at 08:07
  • what details I can provide? –  Apr 07 '14 at 08:12
  • You can try running MIDL from the command prompt and see if it prints some more detailled error information. – Carsten Apr 07 '14 at 12:09
  • No, it doesn't give me any details at all :) just a blank line after processing oaidl.acf. I'm trying to compile an ODL file, and it stops always while processing oaidl.acf. I'm trying to read something about odl/idl/midl, but at the moment I don't know what to do! Any hint is apreciated! –  Apr 07 '14 at 13:18

1 Answers1

13

I was getting the same error when trying to compile an OCX project that was upgraded in VS2013. I had to open the .odl file and move the #include statements inside the library block.

Before:

#include <olectl.h>
#include <idispids.h>

[ uuid(...), version(1.0), ... ]
library ...
{
    importlib(STDOLE_TLB);
    importlib(STDTYPE_TLB);

After:

[ uuid(...), version(1.0), ... ]
library ...
{
    #include <olectl.h>
    #include <idispids.h>
    importlib(STDOLE_TLB);
    importlib(STDTYPE_TLB);

You may also be able to fix your problem by removing the /mktyplib203 switch from your MIDL settings.

Project->Properties->Configuration Properties->MIDL->General->MkTypLib Compatible: Yes (/mktyplib203)

This is very similar to this problem: FIX: Platform SDK Causes MIDL to Throw MIDL2311 Error

MIDL2311 : statements outside library block are illegal in mktyplib compatibility mode.
Mathew Leger
  • 1,613
  • 17
  • 22