Fortran 77和gfortran中的可分配阵列 [英] Allocatable arrays in fortran 77 and gfortran

查看:277
本文介绍了Fortran 77和gfortran中的可分配阵列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用gfortran编译一些旧的fortran77程序,并得到可分配数组的错误。
如果我用f90风格定义数组,如:

I'm trying to compile some old fortran77 programs with gfortran and getting error with allocatable arrays. If I define arrays in f90-style, like:

REAL*8,allocatable::somearray(:)

一切都很好,但是在那些旧的程序数组中定义为:

everything is fine, but in those old programs arrays defined as:

REAL*8  somearray[ALLOCATABLE](:)

导致gfortran错误输出:

which cause gfortran error output:

REAL*8,allocatable::somearray[ALLOCATABLE](:)                        
                             1
Fatal Error: Coarrays disabled at (1), use -fcoarray= to enable

我真的希望避免将整个程序重写为f90风格,所以,请你告诉我,有没有办法强制gfortran编译它?
非常感谢。

I really wish to avoid rewriting whole programs to f90 style, so, could you please tell me, is there any way to force gfortran to compile it? Thanks a lot.

推荐答案

对于标准检查,您可以使用 - 标准标记

For standard checking you can use -std flag


-std = std
指定程序预期符合的标准,可以是 f95', f2003', f2008', gnu'或`legacy'。

-std=std Specify the standard to which the program is expected to conform, which may be one of f95',f2003', f2008',gnu', or `legacy'.

若要强制 gfortran 来编译您的代码,您必须使用它可识别的语法

To "force" gfortran to compile your code, you have to use syntax it recognizes

这篇关于Fortran 77和gfortran中的可分配阵列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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