PRB: F2347 or F2201 Error When Function Is Not Typed

Last reviewed: December 9, 1995
Article ID: Q123689
The information in this article applies to:
  • Microsoft FORTRAN Compiler for MS-DOS, version 5.1
  • Microsoft FORTRAN PowerStation for MS-DOS, versions 1.0 and 1.0a
  • Microsoft FORTRAN PowerStation 32 for Windows NT, version 1.0 and 4.0

SYMPTOMS

When compiling, you receive the following error message:

   F2347: <function name> : missing Type

You may also receive the following error message:

   F2201: <function name> : Type redefined

Error F2347 is not documented in the Microsoft FORTRAN Professional Development System version 5.1.

CAUSE

The return type of a FORTRAN function must be declared in the calling scope. If the type is not defined, implicit typing will occur. If you use the IMPLICIT NONE statement, you will receive the F2347 error. If you do not use the IMPLICIT NONE statement and the implicit typing does not agree with the formal declaration of the function, you will receive the F2201 error.

RESOLUTION

Provide explicit typing for FORTRAN functions, as in the code sample below.

STATUS

This behavior is by design.

MORE INFORMATION

Compiling the sample code that follows will generate the F2201 error. Removing the comment on the IMPLICIT NONE line will cause it to generate the F2347 error in addition to the F2201 error. Removing the comment on the INTEGER func line will resolve both errors.

NOTE: Under Fortran PowerStation 4.0 the following error message is displayed when compiling the Sample Code as given:

   error FOR2205: wrong data type for reference to FUNCTION FUNC
   from procedure TEST

The following error message is displayed if you uncomment the IMPLICIT NONE line:

   error FOR2290: implicit type for FUNC

Sample Code to Demonstrate Behavior

/* Compile options needed: none
*/
      PROGRAM test

C IMPLICIT NONE

      REAL a, b
C INTEGER func

      a = 2.0
      b = 3.0
      b = func(a, b)
      WRITE(*, *) func(a, b)

      END

      INTEGER FUNCTION func(a, b)
      REAL a, b

      PRINT*, a, b

      func = int(a)

      RETURN
      END


Additional reference words: 5.10 1.00 1.00a 4.00 docerr errmsg err msg
KBCategory: kbprg kberrmsg kbprb kbdocerr
KBSubcategory:


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