Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

BUG: Error MIDL2311 When You Compile an MFC ActiveX Control with Internet Explorer 5.5 Headers


View products that this article applies to.

This article was previously published under Q282068

↑ Back to the top


Symptoms

When you compile a Microsoft Foundation Class (MFC) ActiveX control project with the Internet Explorer 5.5 header files, you may receive the following error message:
error MIDL2311 : statements outside library block are illegal in mktyplib compatability mode : [ ]

↑ Back to the top


Cause

This problem occurs because the Olectl.h file, as shown below, does not hide the #pragma once directive as expected:
#ifndef _OLECTL_H_
#define _OLECTL_H_

#if _MSC_VER > 1000
#pragma once
#endif

#if !defined(__MKTYPLIB__) && !defined(__midl)
				
Olectl.h is located in the Ie55headers\Ie55_lib\Include folder.

↑ Back to the top


Resolution

There are two ways to work around this problem:
  • Modify the top of Olectl.h to hide the #pragma once directive as follows:
    #ifndef _OLECTL_H_
    #define _OLECTL_H_
    
    #if !defined(__MKTYPLIB__) && !defined(__midl)
    
    #if _MSC_VER > 1000
    #pragma once
    #endif
    					
  • Because you receive the error only when the directory that contains the Internet Explorer 5.5 headers is the first directory for the Internet Explorer headers, you can rearrange the include directory order. To do this, follow these steps:
    1. On the Tools menu, click Options.
    2. On the Directories tab, change the include directory order in the Microsoft Visual C++ Integrated Development Environment (IDE) so that another include directory that contains Olectl.h and the Internet Explorer 5 headers precedes the Internet Explorer 5.5 headers.

      NOTE: This prevents you from using any of the headers in Internet Explorer 5.5.

↑ Back to the top


Status

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

↑ Back to the top


More information

When you program with the new features in Internet Explorer 5.5, you must download the Headers and Libraries and install them onto your development environment. You can download the Headers and Libraries for Internet Explorer 5.5 from the following Microsoft Web site:

↑ Back to the top


References

For more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:

↑ Back to the top


Keywords: KB282068, kbpending, kbctrl, kbbug

↑ Back to the top

Article Info
Article ID : 282068
Revision : 5
Created on : 5/11/2006
Published on : 5/11/2006
Exists online : False
Views : 724