Microsoft KB Archive/48025

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

Article ID: 48025

Article Last Modified on 12/1/2003

-

APPLIES TO


 * Microsoft FORTRAN Compiler 5.0
 * Microsoft FORTRAN Compiler 5.1
 * Microsoft FORTRAN Compiler 5.0
 * Microsoft FORTRAN Compiler 5.1

-



This article was previously published under Q48025



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 &quot;Advanced Topics&quot; manual for version 5.1 or page 138 of the Microsoft FORTRAN &quot;Advanced Topics&quot; 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 query words: 5.00 5.10 L2029

Keywords: KB48025

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.