Fortran错误:错误:标签语句中的非数字字符(1)

时间:2015-01-08 09:09:59

标签: fortran fortran95

这是我的程序

 Subroutine( m,n, bb,AA)
 integer::m,n 

Real bb(m),AA(m,n)

   print*,'enter b value'
 read*,bb
print*,'enter A value'
 read *,AA

Print*, bb
Print *, AA
end

这是错误,如何解决;

编译器输出:

   YCbT17Kz.f:1.2:

    Subroutine( m,n, bb,AA)
    1
    Error: Non-numeric character in statement label at (1)
    YCbT17Kz.f:1.2:

    Subroutine( m,n, bb,AA)
    1
    Error: Unclassifiable statement at (1)
    YCbT17Kz.f:2.2:

    integer::m,n
    1
    Error: Non-numeric character in statement label at (1)
    YCbT17Kz.f:2.2:

    integer::m,n
    1
    Error: Unclassifiable statement at (1)
    YCbT17Kz.f:4.1:

    Real bb(m),AA(m,n)
    1
    Error: Non-numeric character in statement label at (1)
    YCbT17Kz.f:4.1:

    Real bb(m),AA(m,n)
    1
    Error: Unclassifiable statement at (1)
    YCbT17Kz.f:6.4:

    print*,'enter b value'
    1
    Error: Non-numeric character in statement label at (1)
    YCbT17Kz.f:6.4:

    print*,'enter b value'
    1
    Error: Unclassifiable statement at (1)
    YCbT17Kz.f:7.2:

    read*,bb
    1
    Error: Non-numeric character in statement label at (1)
    YCbT17Kz.f:7.2:

    read*,bb
    1
    Error: Unclassifiable statement at (1)
    YCbT17Kz.f:8.1:

    print*,'enter A value'
    1
    Error: Non-numeric character in statement label at (1)
    YCbT17Kz.f:8.1:

    print*,'enter A value'
    1
    Error: Unclassifiable statement at (1)
    YCbT17Kz.f:9.2:

    read *,AA
    1
    Error: Non-numeric character in statement label at (1)
    YCbT17Kz.f:9.2:

    read *,AA
    1
    Error: Unclassifiable statement at (1)
    YCbT17Kz.f:11.1:

    Print*, bb
    1
    Error: Non-numeric character in statement label at (1)
    YCbT17Kz.f:11.1:

    Print*, bb
    1
    Error: Unclassifiable statement at (1)
    YCbT17Kz.f:12.1:

    Print *, AA
    1
    Error: Non-numeric character in statement label at (1)
    YCbT17Kz.f:12.1:

    Print *, AA
    1
    Error: Unclassifiable statement at (1)
    YCbT17Kz.f:13.1:

    end
    1
    Error: Non-numeric character in statement label at (1)
    YCbT17Kz.f:13.1:

    end
    1

Error: Unclassifiable statement at (1) 

1 个答案:

答案 0 :(得分:3)

   Subroutine( m,n, bb,AA)

不是有效的Fortran语法。语言要求

   Subroutine name_of_the_subroutine(m, n, bb, AA)

错误消息

Real bb(m),AA(m,n)
1
Error: Non-numeric character in statement label at (1)
YCbT17Kz.f:4.1:

建议您使用固定来源表单,其中第1-5列中需要使用数字标签。声明本身必须从第7列或更高版本开始。但我可以想象它可能是先前错误的结果。

最好的方法是尝试纠正第一个错误,并将文件重命名为后缀.f90,表示@francescalus在评论中建议的自由格式源。它很可能会揭示您可能想要自己解决的其他错误,或者询问有关它们的新问题。

如果在线编译器不允许更改文件名,您可以尝试通过编译器选项强制使用自由格式源,例如gffran的-ffree-form和其他编译器的类似。