Fortran 2003 源文件的正确后缀 - 英特尔 Fortran 编译器 [英] Correct suffix for Fortran 2003 source file - Intel Fortran compiler

查看:74
本文介绍了Fortran 2003 源文件的正确后缀 - 英特尔 Fortran 编译器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一小段代码,试图遵守 Fortran 2003 标准.代码在 github 上可用.

I've written a small snippet of code, trying to adhere to the Fortran 2003 standard. The code is available on github.

这是我的生成文件:

FC = gfortran
FLGS = -g -pg -std=f2003 -I. -fbounds-check
DEPS = camx.prm
OBJ = unit-test-hadvppm.o hadvppm.o

#linker macro
%.o: %.f03 $(DEPS)
        $(FC) -c -o $@ $< $(FLGS)

#build targets

gnu-amd64-linux: $(OBJ)
        $(FC) -o $@ $^ $(FLGS)

clean: gnu-amd64-linux
        rm *.o

使用上面的 makefile 和 gfortran 编译代码没有问题.

The code compiles without a problem using the above makefile and gfortran.

但是,如果我尝试用 iFort 编译它,只使用

However, if I try to compile it with iFort, using just

ifort -o ifort-amd64-linux unit-test-hadvppm.f03 hadvppm.f03

它不起作用,请参阅下面的输出.我想这与 .f03 自由文件格式有关.iFort 中是否有类似于 gfortran 的 -std=f2003 标志的标志?我试图在 iFort 文档中找到这个,我应该更仔细地看一下吗?

it doesn't work, see the output below. I suppose that this has to do with the .f03 free file format. Is there a flag in iFort similar to gfortran's -std=f2003 flag? I tried to find this in the iFort Documentation, should I look harder?

推荐答案

标准中没有指定文件后缀的内容.英特尔始终表示,他们将 *.f90 视为免费源格式的后缀,而与标准版本无关.这只是一个不基于任何标准文档的约定.

There is nothing in the standard that specifies the suffix of the files. Intel always stated, that they treat *.f90 as the suffix for the free source format irrespective of the standard version. It is just a convention not based on any standard document.

也许 f90 后缀有点不幸,看起来只适用于 Fortran 90,但您应该毫不犹豫地将它用于每个自由格式的源文件.

Maybe the f90 suffix is little unfortunate, looking like just for Fortran 90, but you shouldn't hesitate to use it for every free-format source file.

我个人也不喜欢.f95.f03.f08文件的做法.我是否应该仅仅因为我从较新的标准中调用一些内在函数而重命名源文件?

Personally, I also do not like the practice of .f95,.f03, .f08 files. Should I rename the source file just because I call some intrinsic from a newer standard?

这篇关于Fortran 2003 源文件的正确后缀 - 英特尔 Fortran 编译器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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