PRB: Unexpected "This Program Requires Microsoft Windows" Msg

Last reviewed: July 17, 1997
Article ID: Q84323
5.0x 5.1x 5.20 5.3x 5.50 | 5.0x 5.10 5.11 5.13 5.15
MS-DOS                   | OS/2
kbtool kbcode kberrmsg kberrmsg kbprb

The information in this article applies to:

  • Microsoft LINK for MS-DOS, versions 5.0x, 5.1x, 5.2, 5.3x, and 5.5
  • Microsoft LINK for OS/2, versions 5.0x, 5.1, 5.11, 5.13, and 5.15

SYMPTOMS

An attempt to run, in MS-DOS, an application generated by Microsoft FORTRAN version 5.1, fails and generates the following message:

   This program requires Microsoft Windows

If the application is run in Windows, the system may open an MS-DOS session, display the message above and close the MS-DOS session, returning to Windows without running the application.

CAUSE

Most likely, one of the following errors occurred linking the application:

   L2025: Multiply Defined Symbol
   L2029: Unresolved External

When one of these errors occurs, Microsoft LINK sets an error bit in the executable file header. The error bit warns the application loader that the file contains an error. In Windows, this bit causes the loader to start an MS-DOS session for the application. If the application is designed for Windows, the MS-DOS correctly displays the error message above.

If an L2025 or L2029 error occurs creating an application for the MS-DOS operating system, the loader does not reject the application. However, in the MS-DOS operating system, running an application that has unresolved externals may generate incorrect results or cause the system to hang. In the OS/2 operating system, the application generates a general protection (GP) fault if it attempts to access a restricted memory location.

RESOLUTION

The best method to address this situation involves resolving the LINK error at its source. If this is not possible or undesirable, use the EXEHDR utility to manually reset the error bit. The syntax to call the EXEHDR utility is as follows:

   EXEHDR /r <filename>

STATUS

Versions 3.0 and 3.1 of the Windows loader each interpret the error bit as described above.

MORE INFORMATION

The following FORTRAN code reproduces the problem:

Sample Code

This is the source code for the SAMPLE.FOR file:

      PROGRAM Sample_Test
      PRINT *, 'FORTRAN Test'
      GOTO 20
      CALL MySub (123)          ! MySub is unresolved at link time
 20   CONTINUE
      END

Project Makefile

ALL : Sample.EXE

Sample.EXE : Sample.OBJ

   Link Sample.OBJ,, nul, /NOD LLIBFEW.LIB, FL.DEF

Sample.OBJ : Sample.FOR
   FL /c /MW Sample.FOR


Additional reference words: 5.01.20 5.01.21 5.02 5.03 5.05 5.10 5.11
5.13 5.15 5.20 5.30 5.31.009 5.50
KBCategory: kbtool kbcode kberrmsg kberrmsg kbprb
KBSubcategory: LinkIss
Keywords : kb16bitonly


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 17, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.