PRB: L2029 Error, FGRAPH.FD, FGRAPH.FI Files Used Incorrectly

Last reviewed: July 18, 1995
Article ID: Q48025
The information in this article applies to:
  • Microsoft FORTRAN for MS-DOS and OS/2, version 5.0, 5.1

SYMPTOMS

An attempt to link an application fails and an L2029 unresolved externals error occurs.

CAUSE

The FGRAPH.FI file is placed at the beginning of the main file and FGRAPH.FD is placed in a subroutine in a separate file. This cause applies ONLY when the symbol name is a graphics function, and it is in all capitol letters with no leading underscore.

RESOLUTION

Modify the source code to include the FGRAPH.FI file (the INTERFACE statements) at the beginning of each file that contains a graphics call. Include the FGRAPH.FD file (the variable declarations) in each subroutine that calls a graphics routine.

This behavior does not occur with FORTRAN PowerStation. Sample 1 below builds without error.

MORE INFORMATION

For more information on the FGRAPH.FD and FGRAPH.FI files, see page 180 of the Microsoft FORTRAN "Advanced Topics" manual for version 5.1 or page 138 of the Microsoft FORTRAN "Advanced Topics" manual for version 5.0.

The following code example demonstrates this problem.

Sample Code #1

C Place the main program and subroutine in the same file

C Compile options needed: None

      INCLUDE 'FGRAPH.FI'   ! interface statements at file beginning
      PROGRAM GRAPH
      CALL DUMMY
      END

      SUBROUTINE DUMMY()
      INCLUDE 'FGRAPH.FD'   ! declarations within the subroutine
      CALL clearscreen( $GCLEARSCREEN )
      RETURN
      END

The following code example demonstrates the correct method to make graphics calls.

Sample Code #2

C Place the main program in a separate file

C Compile options needed: None

      PROGRAM GRAPH    ! No graphics calls in this file, so include
      CALL DUMMY       ! files are not necessary in this file
      END

C Place the subroutine into a separate file

C Compile options needed: None

      INCLUDE 'FGRAPH.FI'  ! interface statements at file beginning
      SUBROUTINE DUMMY()
      INCLUDE 'FGRAPH.FD'  ! declarations within the subroutine
      CALL clearscreen( $GCLEARSCREEN )
      RETURN
      END


Additional reference words: 5.00 5.10 L2029
KBCategory: kbprg kberrmsg kbcode kbprb
KBSubcategory: FORTLngIss


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 18, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.