Fortran IV,名为常量的编译错误 [英] Fortran IV, compiling error named constant

查看:147
本文介绍了Fortran IV,名为常量的编译错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用gcc fortran编译器(gfortran 4.8.1 -4)编译旧的Fortran IV代码.我将编译器运行为:gfortran nrlxrf_a.for -std = legacy.这些是错误消息:

I am trying to compile an old Fortran IV code using the gcc fortran compiler (gfortran 4.8.1 -4). I run the compiler as: gfortran nrlxrf_a.for -std=legacy. These are the error messages:

C:\ MinGW \ bin> gfortran nrlxrf_a.for -std = legacy

C:\MinGW\bin>gfortran nrlxrf_a.for -std=legacy

NRLXRF_a.for:5525.72:

NRLXRF_a.for:5525.72:

  IF ( NFILL.EQ. 0)
                                                                    1

错误:无法分配(1)处的命名常量

Error: Cannot assign to a named constant at (1)

我已经检查了这一行,语句结尾之后没有空格.

I have checked the line, and there are no spaces after the end of the statement.

NRLXRF_a.for:5531.7:

NRLXRF_a.for:5531.7:

 1 ( HFILL( I), I= 1, NFILL), ( H( IU, I), I= I1, I2)
   1

错误:无法分配(1)处的命名常量

Error: Cannot assign to a named constant at (1)

任何建议将不胜感激. 托马斯

Any suggestions would be greatly appreciated. Thomas

这是使用HFILL和NFILL的代码部分.这是为编译器选择正确的选项还是语法错误?

This is the code section where HFILL and NFILL are used. Is this a matter of selecting the correct option for the compiler or a syntax error?

C:DOC IS THE DATUM NUMERIC?  IF SO, GO TO 44; ELSE GO TO 50.
       NFILL= 0
       HTEST= H( IU, I1)
      IF ( HTEST.NE. HSIGN( 1)) GO TO 41
      GO TO 45
C:-------
 41   IF ( HTEST.NE. HSIGN( 2)) GO TO 42
 45    NFILL= 1
       HTEST= H( IU, I1+ 1)
 42   DO 43 J= 1, 11
      IF ( HTEST.EQ. HDIG( J)) GO TO 44
   43 CONTINUE
       NFILL= 0
      GO TO 50
C:-------
C:DOC DATUM IS NUMERIC.  CALCULATE NO. OF BLANKS TO RIGHT-JUSTIFY.
 44    NFILL= NC- NII
      IF ( I2P.NE. I2) WRITE( KW, 111) ( H( IU, J), J= I1, I2P)
      IF ( I2P.NE. I2) WRITE( KW, 112) ( H( IU, J), J= I1, I2)
C:DOC WRITE ANY FILL BLANKS AND DATUM TO SCRATCH FILE.
 50   CONTINUE
      IF ( NFILL.EQ. 0) WRITE( KS, 102) ( H( IU, I), I= I1, I2)
      IF ( NFILL.EQ. 0)                                             line 5525
C:     1 ENCODE( NC, 102, HIN( 4* NR- 3)) ( H( IU, I), I= I1, I2)
      IF ( NFILL.NE. 0) WRITE( KS, 102)
     1 ( HFILL( I), I= 1, NFILL), ( H( IU, I), I= I1, I2)
      IF ( NFILL.NE. 0)
C:     1 ENCODE( NC, 102, HIN( 4* NR- 3))
     1 ( HFILL( I), I= 1, NFILL), ( H( IU, I), I= I1, I2)           line 5531
       I1= I3+ 1

推荐答案

如果假定代码基于

If one assumes that the code is based on that from http://www.nist.gov/mml/csd/inorganic/xrf.cfm then the problem is that gfortran is not a Fortran IV compiler and it doesn't support extensions that other compilers did.

从该来源获取第一个错误的完整行"(考虑到连续性):

From that source the full "line" (taking into account continuation is) for the first error:

      IF ( NFILL.EQ. 0)
     1 ENCODE( NC, 102, HIN( 4* NR- 3)) ( H( IU, I), I= I1, I2)

根据 gfortran文档 ENCODE不支持.

我想您提供给您(或其他人)的代码已尝试删除有问题的行.但是错误地:行已删除,但不是完整的语句,该语句可以包含许多行.

I guess that in the code you've presented you (or someone) has attempted to remove the troublesome lines. But incorrectly: lines have been removed, but not whole statements, which can consist of many lines.

忽略删除编码会从根本上改变代码含义这一事实,您需要删除出现ENCODE的整个语句.删除所有后续的延续线和第一条先前的非延续线.在这种情况下,请输入5525、5529和5520行.

Ignoring the fact that removing the encoding fundamentally changes the meaning of the code, you'll need to remove the whole statements where the ENCODEs appear. Remove all subsequent continuation lines and the first preceding non-continuation line. Lines 5525, 5529 and 5520 in these cases.

这篇关于Fortran IV,名为常量的编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆