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

ID: Q48025

5.00 5.10 MS-DOS kbprg kberrmsg kbprb kbcode

The information in this article applies to:

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

Last Reviewed: April 30, 1998