使用gfortran编译fortran77代码时出错

时间:2019-05-07 21:46:56

标签: fortran gfortran fortran77

在Cygwin上用gfortran进行编译时,我有一个fortran77代码(公共域),产生以下错误。我该如何解决这个问题?

gfortran -o GR3DSTR GR3DSTR.f77 /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../x86_64-pc-cygwin/bin/ld:GR3DSTR. f77: file format not recognized; treating as linker script /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../x86_64-pc-cygwin/bin/ld:GR3DSTR. f77:2: syntax error collect2: error: ld returned 1 exit status

当我将其作为自由格式使用时,会产生更多错误。

*************************************************************************
*   PROGRAM GR3DSTR TO DEDUCE THE 3-D STRUCTURE OF                      *
*   SEDIMENTARY BASIN FROM ITS GRAVITY ANOMALIES WITH A                 *
*   QUADRATIC DENSITY FUNCTION.                                         *
*                                                                       *
*   INPUT                                                               *
*   ------                                                              *
*       GOBS : OBSERVED GRAVITY ANOMALIES (MGALS)                       *
*       NX   : NUMBER OF OBSERVATIONS IN X-DIRECTION                    *
*       NY   : NUMBER OF OBSERVATIONS IN Y-DIRECTION                    *
*       DX   : STATION INTERVAL  IN X-DIRECTION (KM)                    *
*       DY   : STATION INTERVAL  IN Y-DIRECTION (KM)                    *
*       A0,A1 : COEFFICIENTS OF QUADRATIC DENSITY FUNCTION              *
*        &A2 : FUNCTION (GM/CC)                                         *
*       ITER1 : TOTAL NUMBER OF ITERATIONS REQUIRED                     *
*       ITR1  : NUMBER OF ITERATIONS REQUIRED IN FIRST STAGE            *
*       ITR2  : NUMBER OF ITERATIONS REQUIRED IN SECOND STAGE           *
*       LT1   : LIMITING VALUE OF THE DOMAIN IN WHICH EXACT             *
*               EQUATION IS USED FOR ANOMALY CALCULATION                *
*                                                                       *
*   OUTPUT                                                              *
*   ------                                                              *
*       GCAL  : CALCULATED GRAVITY ANOMALIES (MGALS)                    *
*       Z2  : DEPTH TO THE BOTTOM (BASEMENT) (KM)                       *
*                                                                       *
*       SUPPORTING SUBROUTINES AND SUBPROGRAMS:                         *
*       ---------------------------------------                         *
*       : INIT, STRUC, BOTT, RESUL, ANOM1, & ANOM2                      *
*************************************************************************
    DIMENSION X(50),Y(50),GOBS(50,50),GCAL(50,50),Z(50,50),LT1(3)
    PI=3.14159265
    CONST=PI*40.0/3.0
    READ(*,801)NX,NY,DX,DY,ITER1,A0,A1,A2
    READ(*,802)ITR1,ITR2
    READ(*,803)(LT1(I),I=1,3)
    WRITE(*,901)NX,NY,DX,DY,ITER1,A0,A1,A2
    WRITE(*,902)ITR1,ITR2
    WRITE(*,903)(LT1(1),I=1,3)
    DO 100 I=1,NX
100 X(I)=FLOAT(I-1)*DX 
    DO 110 J=1,NY
110 Y(J)=FLOAT(J-1)*DY
    DO 120 J=1,NY 
    READ(*,804)(GOBS(I,J),I=1,NX)
    WRITE(*,904)(GOBS(I,J),I=1,NX)
110 CONTINUE 
    CALL INIT(NX,NY,A0,X,Y,GOBS,CONST,Z)
    DO 130 ITER=1,ITER1
    CALL STRUC(NX,NY,DX,DY,A0,A1,A2,X,Y,Z,ITER,ITR1,ITR2,LT1,GCAL)
    CALL RESUL(NX,NY,ITER,X,Y,Z,GOBS,GCAL)
    CALL BOTT(NX,NY,CONST,A0,A1,A2,GOBS,GCAL,Z)
130 CONTINUE
801 FORMAT(2I10,2F10.4,I10,3F10.4)
802 FORMAT(2I10)
803 FORMAT(3I10)
804 FORMAT(11F7.3)
901 FORMAT(2I10,2F10.5,I10,3F10.5)
902 FORMAT(2110)
903 FORMAT(3I10)
904 FORMAT(1X,20F6.1)
    STOP
    END

*************************************************************************
*   SUBROUTINE INIT: CALCULATES THE INITIAL ESTIMATES OF
*                    THE STRUCTURE.
*
*   INPUT
*   -----
*       NX  :   NUMBER OF OBSERVATIONS IN X-DIRECTION 
*       NY  :   NUMBER OF OBSERVATIONS IN Y-DIRECTION 
*       A0  :   CONSTANT DENSITY CONTRAST (GM/CC)
*       X   :   DISTANCE TO THE ANOMALY POINT IN X-DIRECTION
*       Y   :   DISTANCE TO THE ANOMALY POINT IN Y-DIRECTION
*       GOBS :  OBSERVED GRAVITY ANOMALIES (MGALS)
*       CONST : PI*40.0/3.0
*
*   OUTPUT
*   ------
*       Z   : DEPTH TO THE BOTTOM (KM)
************************************************************************* 
    SUBROUTINE INIT(NX,NY,A0,X,Y,GOBS,CONST,Z)
    DIMENSION X(50),(Y50),GOBS(50,50),Z(50,50)
    DO 100 J=1,NY
        DO 100 I=1,NX
         Z(I,J)=GOBS(I,J)/(CONST*A0)
         IF (Z(I,J).LE.0.0)THEN
            Z(I,J)=0.001
        ENDIF
100 CONTINUE
    WRITE(*,905)
    D0 110 J=1,NY
    WRITE(*,906)(Z(I,J),I=1,NX)
110 CONTINUE
905 FORMAT(//5X, 'INITIAL ESTIMATES OF THE STRUCTURE'/)
906 FORMAT(20F6.2)
    RETURN
    END

*************************************************************************
*   SUBROUTINE STRUC: CALCULATES THE GRAVITY ANOMALIES OF A
*                     SEDIMENTARY BASIN BY THE COMBINED USE 
*                     OF EXACT AND APPROXIMATE EQUATIONS OF 
*                     PRISMATIC MODEL
*
*   INPUT
*   -----
*       NX  :   NUMBER OF OBSERVATIONS IN X-DIRECTION 
*       NY  :   NUMBER OF OBSERVATIONS IN Y-DIRECTION 
*       DX  :   STATION INTERVAL  IN X-DIRECTION (KM)                   *
*       DY  :   STATION INTERVAL  IN Y-DIRECTION (KM)                   *
*       A0,A1 : COEFFICIENTS OF QUADRATIC DENSITY FUNCTION              *
*        &A2 : FUNCTION (GM/CC)                                         *
*       X   :   DISTANCE TO THE ANOMALY POINT IN X-DIRECTION
*       Y   :   DISTANCE TO THE ANOMALY POINT IN Y-DIRECTION
*       Z   :   DEPTH TO THE BOTTOM (KM)
*       ITER : ITERATION NUMBER                     *
*       ITR1  : NUMBER OF ITERATIONS REQUIRED IN FIRST STAGE            *
*       ITR2  : NUMBER OF ITERATIONS REQUIRED IN SECOND STAGE           *
*       LT1   : LIMITING VALUE OF THE DOMAIN IN WHICH EXACT             *
*               EQUATION IS USED FOR ANOMALY CALCULATION
*       T     : HALF THICKNESS OF THE PRISM (KM)
*       W     : HALF WIDTH OF THE PRISM (KM)
*
*   OUTPUT
*   ------
*       GCAL    : CALCULATED GRAVITY ANOMALIES (MGALS)
************************************************************************* 
    SUBROUTINE STRUC(NX,NY,DX,DY,A0,A1,A2,X,Y,Z,ITER,ITR1,ITR2,LT1,GCAL)
    DIMENSION X(50),Y(50),Z(50,50),GCAL(50,50),LT1(3)
    T=DX/2.0
    W=DY/2.0
    Z1=0.001
    DO 100 I=1,NX 
        DO 100 J=1,NY
100 GCAL(I,J)=0.0
    IF (ITER.LT.ITR1)THEN
        LT=LT1(1)
        GOTO 110
        ELSE
            IF (ITER.LE.ITR2)THEN
                LT=LT1(2)
                GOTO 110
            ELSE
                LT=LT1(3)
            ENDIF
        ENDIF
110 DO 140 I=1,NX
     DO 140 M=1,NX
      XX1=X(I)-X(M)
      DO 140 J=1,NY
       DO 140 N=1,NY 
        YY1=Y(J)-Y(N)
        Z2=Z(M,N)
        IF(ABS(I-M).LE.LT)THEN
        IF(ABS(J-N).LE.LT)THEN
          GCAL1=ANOM1(A0,A1,A2,XX1,YY1,T,W,Z1,Z2)
          GOTO 130
        ELSE
          GOTO 120
        ENDIF
       ELSE
          GOTO 120
        ENDIF
120 GCAL1=ANOM2(A0,A1,A2,DX,DY,XX1,XX2,Z1,Z2)
130 CONTINUE
140 GCAL(I,J)=GCAL(I,J)+GCAL1
    RETURN
    END 

*************************************************************************
*   FUNCTION SUBPROGRAM ANOM1: CALCULATES THE ANOMALY OF 
*                     PRISMATIC MODEL WITH EXACT  
*                     EQUATION
*   INPUT
*   -----
*       A0,A1 : COEFFICIENTS OF QUADRATIC DENSITY                       *
*        &A2 : FUNCTION (GM/CC)                                         *
*       XX1 :   DISTANCE TO THE POINT OF CALCULATION
*               IN X-DIRECTION WITH REFERENCE TO THE 
*               EPICENTRE OF THE PRISM UNDER CONSIDERATION
*       YY1 :   DISTANCE TO THE POINT OF CALCULATION
*               IN Y-DIRECTION WITH REFERENCE TO THE 
*               EPICENTRE OF THE PRISM UNDER CONSIDERATION
*       T   :   HALF THICKNESS      OF THE PRISM (KM)
*       W   :   HALF WIDTH          OF THE PRISM (KM)
*       Z1  :   DEPTH TO THE TOP    OF THE PRISM (KM)
*       Z2  :   DEPTH TO THE BOTTOM OF THE PRISM (KM)
*       GAMA :  GRAVITATIONAL CONSTANT
*************************************************************************
        FUNCTION ANOM1(A0,A1,A2,XX1,YY1,T,W,Z1,Z2)
        GAMA=20.0/3.0
        X1=XX1+T
        X2=XX1-T
        Y1=YY1+W 
        Y2=YY1-W 
        IF(X1.EQ.0.0)THEN
            X1=0.0001
        ENDIF 
        IF(X2.EQ.0.0)THEN
            X2=0.0001
        ENDIF
        IF(Y1.EQ.0.0)THEN
            Y1=0.0001
        ENDIF
        IF(Y2.EQ.0.0)THEN
            Y2=0.0001
        ENDIF
        R1=SQRT(X2*X2+Y2*Y2+Z1*Z1)
        R2=SQRT(X2*X2+Y2*Y2+Z2*Z2)
        R3=SQRT(X2*X2+Y1*Y1+Z1*Z1)
        R4=SQRT(X2*X2+Y1*Y1+Z2*Z2)
        R5=SQRT(X1*X1+Y2*Y2+Z1*Z1)
        R6=SQRT(X1*X1+Y2*Y2+Z2*Z2)
        R7=SQRT(X1*X1+Y1*Y1+Z1*Z1)
        R8=SQRT(X1*X1+Y1*Y1+Z2*Z2)
        F11=X2*Y2/(Z2*R2)
        F12=X2*Y1/(Z2*R4)
        F13=X1*Y2/(Z2*R6)
        F14=X1*Y1/(Z2*R8)
            B1=ATAN(F11)-ATAN(F12)-ATAN(F13)+ATAN(F14)
        F21=X2*Y2/(Z1*R1)
        F22=X2*Y1/(Z1*R3)
        F23=X1*Y2/(Z1*R5)
        F24=X1*Y1/(Z1*R7)
            B2=ATAN(F21)-ATAN(F22)-ATAN(F23)+ATAN(F24)      
        F31=(R2-Y2)/(R2+Y2)
        F32=(R1-Y2)/(R1+Y2)
        F33=(R4-Y1)/(R4+Y1)
        F34=(R3-Y1)/(R3+Y1)
            B3=ALOG(F31*F34/(F32*F33))
        F41=(R5-Y2)/(R5+Y2)
        F42=(R6-Y2)/(R6+Y2)
        F43=(R7-Y1)/(R7+Y1)
        F44=(R8-Y1)/(R8+Y1)     
            B4=ALOG(F41*F44/(F42*F43))
        F51=(R2-X2)/(R2+X2)
        F52=(R1-X2)/(R1+X2)
        F53=(R6-X1)/(R6+X1)
        F54=(R5-X1)/(R5+X1)     
            B5=ALOG(F51*F54/(F52*F53))
        F61=(R3-X2)/(R3+X2)
        F62=(R4-X2)/(R4+X2)
        F63=(R7-X1)/(R7+X1)
        F64=(R8-X1)/(R8+X1)     
            B6=ALOG(F61*F64/(F62*F63))      
        F71=Y2*Z2/(R2*X2)
        F72=Y2*Z1/(R1*X2)
        F73=Y1*Z2/(R4*X2)
        F74=Y1*Z1/(R3*X2)       
        H71=(F71-F72)/(1.0+F71*F72)
        H72=(F73-F74)/(1.0+F73*F74)
            B7=ATAN((H71-H72)/(1.0+H71*H72))
        F81=Y2*Z2/(R6*X1)
        F82=Y2*Z1/(R5*X1)
        F83=Y1*Z2/(R8*X1)
        F84=Y1*Z1/(R7*X1)
        H81=(F81-F82)/(1.0+F81*F82)
        H82=(F83-F84)/(1.0+F83*F84)
            B8=ATAN((H81-H82)/(1.0+H81*H82))
        F91=X2*Z2/(R2*Y2)
        F92=X2*Z1/(R1*Y2)
        F93=X1*Z2/(R6*Y2)
        F94=X1*Z1/(R5*Y2)
        H91=(F91-F92)/(1.0+F91*F92)
        H92=(F93-F94)/(1.0+F93*F94)
            B9=ATAN((H91-H92)/(1.0+H91*H92))
        F101=X2*Z2/(R4*Y1)  
        F102=X2*Z1/(R3*Y1)
        F103=X1*Z2/(R8*Y1)
        F104=X1*Z1/(R7*Y1)
        H101=(F101-F102)/(1.0+F101*F102)
        H102=(F103-F104)/(1.0+F103*F104)
            B10=ATAN((H101-H102)/(1.0+H101*H102))
        B11=ALOG((R2+Z2)/(R1+Z1))
        B12=ALOG((R3+Z1)/(R4+Z2))
        B13=ALOG((R5+Z1)/(R6+Z2))
        B14=ALOG((R8+Z2)/(R7+Z1))
        G1=GAMA*A0*(Z2*B1-Z1*B2+X2/2.0*B3+X1/2.0*B4+Y2/2.0*B5+Y1/2.0*B6)
        G2=GAMA/2.0*A1*(Z2*Z2*B1-Z1*Z1*B2-X2*X2*B7+X1*X1*B8-Y2*Y2*B9+Y1*Y1*B10+2.0*(X2*Y2*B11+X2*Y1*B12+X1*Y2*B13+X1*Y1*B14))
        G3=GAMA/3.0*A2*(Z2*Z2*Z2*B1-Z1*Z1*Z1*B2-(X2*X2*X2)/2.0*B3-(X1*X1*X1)/2.0*B4-(Y2*Y2*Y2)/2.0*B5-((Y1*Y1*Y1)/2.0*B6
        +2.0*(X2*Y2*(R2-R1)+X2*Y1*(R3-R4)+X1*Y2(R5-R6)+X1*Y1(R8-R7)))
        ANOM1=G1+G2+G3
        RETURN
        END 

*************************************************************************
*   FUNCTION SUBPROGRAM ANOM2: CALCULATES THE ANOMALY OF 
*                     PRISMATIC MODEL WITH APPROXIMATE EQUATION
*
*   INPUT
*   -----
*       A0,A1 : COEFFICIENTS OF QUADRATIC DENSITY                       *
*        &A2 : FUNCTION (GM/CC)
*       DX  :   STATION INTERVAL  IN X-DIRECTION (KM)                   *
*       DY  :   STATION INTERVAL  IN Y-DIRECTION (KM)                   *
*       XX1 :   DISTANCE TO THE POINT OF CALCULATION
*               IN X-DIRECTION WITH REFERENCE TO THE 
*               EPICENTRE OF THE PRISM UNDER CONSIDERATION
*       YY1 :   DISTANCE TO THE POINT OF CALCULATION
*               IN Y-DIRECTION WITH REFERENCE TO THE 
*               EPICENTRE OF THE PRISM UNDER CONSIDERATION
*       Z2  :   DEPTH TO THE BOTTOM OF THE PRISM (KM)
*       GAMA :  GRAVITATIONAL CONSTANT
*************************************************************************   
        FUNCTION ANOM2(A0,A1,A2,DX,DY,XX1,YY1,Z1,Z2)
        GAMA=20.0/3.0
        A=DX*DY
        X1=XX1 
        Y1=YY1 
        IF(X1.EQ.0.0)THEN
            X1=0.0001
        ENDIF
        IF(Y1.EQ.0.0)THEN
            Y1=0.0001
        ENDIF
        R1=SQRT(X1*X1+Y1*Y1+Z1*Z1)
        R2=SQRT(X1*X1+Y1*Y1+Z2*Z2)
        IF(R1.EQ.0.0)THEN
            R1=0.0001
        ENDIF
        IF(R2.EQ.0.0)THEN
            R2=0.0001
        ENDIF
        PI=A0*(1.0/R1-1.0/R2)
        P2=A1*(Z1/R1-Z2/R2+ALOG((R2+Z2)/(R1+Z1)))
        P3=A2*(2.0*(R2-R1)+Z1*Z1/R1-Z2*Z2/R2)
        ANOM2=GAMA*A*(P1+P2+P3)
        RETURN
        END 
*************************************************************************
*   SUBROUTINE BOTT: CALCULATES THE STRUCTURE OF A SEDIMENTARY BASIN  
*                     USING THE BOTT'S METHOD.
*
*   INPUT
*   -----
*       NX    : NUMBER OF OBSERVATIONS IN X-DIRECTION
*       NY    : NUMBER OF OBSERVATIONS IN Y-DIRECTION
*       A0,A1 : COEFFICIENTS OF QUADRATIC DENSITY                       *
*        &A2 : FUNCTION (GM/CC)
*       GOBS : OBSERVED GRAVITY ANOMALIES (MGALS)
*       GCAL : CALCULATED GRAVITY ANOMALIES (MGALS)
*       CONST : PI*40.0/3.0
*
*   OUTPUT
*   ------
*       Z   :   DEPTHS TO THE BASEMENT (KM)
*************************************************************************
    SUBROUTINE BOTT(NX,NY,CONST,A0,A1,A2,GOBS,GCAL,Z)
    DIMENSION GOBS(50,50),GCAL(50,50),Z(50,50),DZ(50,50)
        DO 100 I=1,NX
         DO 100 J=1,NY
          R2=A0+A1*Z(I,J)+A2*Z(I,J)*Z(I,J)
          CONST1=CONST*R2
100 DZ(I,J)=(GOBS(I,J)-GCAL(I,J))/CONST1
        DO 110 I=1,NX
         DO 110 J=1,NY
          Z(I,J)=Z(I,J)+DZ(I,J)
           IF (Z(I,J).LE.0.0) THEN
                Z(I,J)=0.001
            END 
110 CONTINUE
    RETURN
    END 


*************************************************************************
*   SUBROUTINE RESUL: GIVES THE RESULTS SUCH AS DEPTHS TO THE BASEMENT   
*                     AND RESIDUAL ANOMALIES 
*
*   INPUT
*   -----
*       NX    : NUMBER OF OBSERVATIONS IN X-DIRECTION
*       NY    : NUMBER OF OBSERVATIONS IN Y-DIRECTION
*       ITER  : ITERATION NUMBER 
*       X     : DISTANCE TO THE ANOMALY POINT IN X-DIRECTION 
*       Y     : DISTANCE TO THE ANOMALY POINT IN Y-DIRECTION
*       Z     : DEPTHS TO THE BASEMENT (KM)
*       GOBS  : OBSERVED GRAVITY ANOMALIES (MGALS)
*       
*       
*   OUTPUT
*   ------
*       GCAL  : CALCULATED GRAVITY ANOMALIES (MGALS)
*************************************************************************
    SUBROUTINE RESUL(NX,NY,ITER,X,Y,Z,GOBS,GCAL)
    DIMENSION X(50),Y(50),GOBS(50,50),GCAL(50,50),RESD(50,50),Z(50,50)
    DO 100 I=1,NX
     DO 100 J=1,NY
100 RESD(I,J)=GOBS(I,J)-GCAL(I.J)
    WRITE(*,907) ITER
    WRITE(*,908)
    DO 110 J=1,NY
     WRITE(*,909)(Z(I,J),I=1,NX)
110 CONTINUE
    WRITE(*,910)
    DO 120 J=1,NY
    WRITE(*,911)(RESD(I,J),I=1,NX)
120 CONTINUE
907 FORMAT(//5X,'ITERATION NO.=',I3)
908 FORMAT(/10X,'DEPTHS TO THE BASEMENT')
909 FORMAT(/20F6.2)
910 FORMAT(//10X,'RESIDUAL ANOMALY'/)
911 FORMAT(20F6.2)
    RETURN 
    END 


*************************************************************************
*   A CONCISE FUNCTION 
*   SUBPROGRAM ANOM1: CALCULATES THE ANOMALY OF PRISMATIC    
*                     MODEL WITH EXACT EQUATION. 
*
*   INPUT
*   -----
*       A0,A1 : COEFFICIENTS OF QUADRATIC DENSITY                       
*        &A2 : FUNCTION (GM/CC)
*       XX1 :   DISTANCE TO THE POINT OF CALCULATION
*               IN X-DIRECTION WITH REFERENCE TO THE 
*               EPICENTRE OF THE PRISM UNDER CONSIDERATION
*       YY1 :   DISTANCE TO THE POINT OF CALCULATION
*               IN Y-DIRECTION WITH REFERENCE TO THE 
*               EPICENTRE OF THE PRISM UNDER CONSIDERATION
*       T   :   HALF THICKNESS      OF THE PRISM (KM)
*       W   :   HALF WIDTH          OF THE PRISM (KM)
*       Z1  :   DEPTH TO THE TOP    OF THE PRISM (KM)
*       Z2  :   DEPTH TO THE BOTTOM OF THE PRISM (KM)
*       GAMA :  GRAVITATIONAL CONSTANT
*************************************************************************   
        FUNCTION ANOM1(A0,A1,A2,XX1,YY1,T,W,Z1,Z2)
        DIMENSION X(2),Y(2),Z(2),R(2,2,2)
        GAMA=20.0/3.0
        X(1)=XX1+T
        X(2)=XX1-T 
        Y(1)=YY1+W
        Y(2)=YY1-W
        Z(1)=Z1
        Z(2)=Z2
        IF(X(1).EQ.0.0)THEN
            X(1)=0.0001
        ENDIF
        IF(X(2).EQ.0.0)THEN 
          X(2)=0.001
        ENDIF
        IF(Y(1).EQ.0.0)THEN
          Y(1)=0.0001
        ENDIF
        IF(Y(2).EQ.0.0)THEN
          Y(2)=0.0001
        ENDIF
        G1=0.0
        G2=0.0
        G3=0.0
        DO 100 I=1,2
            DO 100 J=1,2
                DO 100 K=1,2
                J1=I+J+K
                J2=J1/2
                IF(2*J2.EQ.J1)THEN
                    J3=1
                ELSE
                    J3=-1
                ENDIF
                R(I,J,K)=SQRT(X(I)*X(I)+Y(J)*Y(J)+Z(K)*Z(K))
                F1=ATAN(X(I)*Y(J)/(Z(K)*R(I,J,K)))
                F2=ALOG((R(I,J,K)-Y(J))/(R(I,J,K)+Y(J)))
                F3=ALOG((R(I,J,K)-X(I))/(R(I,J,K)+X(I)))
                F4=ATAN(Y(J)*Z(K)/(X(I)*R(I,J,K)))
                F5=ATAN(X(I)*Z(K)/(Y(J)*R(I,J,K)))  
                F6=X(I)*Y(J)*ALOG(2.0*R(I,J,K)+2.0*Z(K))
                F7=2.0/3.0*X(I)*Y(J)*R(I,J,K)
                G1=G1+J3*A0*(Z(K)*F1+X(I)/2.0*F2+Y(J)/2.0*F3)
                G2=G2+J3*A1*(Z(K)*Z(K)/2.0*F1-X(I)*X(I)/2.0*F4-Y(J)*Y(J)/2.0*F5+F6) 
                G3=G3+J3*A2*(Z(K)*Z(K)*Z(K)/3.0*F1-X(I)*X(I)*X(I)/6.0*F2-Y(J)*Y(J)*Y(J)/6.0*F3+F7)
100 CONTINUE
    ANOM1=GAMA*(G1+G2+G3)
    RETURN
    END

2 个答案:

答案 0 :(得分:0)

您需要将文件重命名为“ GR3DSTR.f”,因为gfortran无法识别.f77文件扩展名。但是,当我尝试编译您发布的代码时,由于无效的语言构造,我会遇到大量的编译器错误(其中至少是省略了PROGRAM和END PROGRAM。您需要对其进行更正后再进行编译)。

答案 1 :(得分:0)

看起来非常像线路终止问题。基本上从第2行开始有一个无法识别的字符。问题是为什么只有第2行却没有其他内容?

检查您的线路终端。由于您正在运行cygwin,请查看vi-设置列表。也许您需要将CR或LF更改为CR LF。

如何更改为正确的线路终端:

  1. 名为unix2dos的Linux实用程序。
  2. 使用Word。剪切整个程序,将其粘贴到Word中。不必担心换行等问题。从Word中剪切并粘贴回去。 Word将正确填写所有行终止。这是Word的晦涩用法,但确实有效。

这可以回答为什么只有第2行-将整个程序当作1行,而最后一行是空白。