用于Fortran 2003源文件的正确后缀 - Intel Fortran编译器 [英] Correct suffix for Fortran 2003 source file - Intel Fortran compiler
问题描述
我写了一小段代码,试图遵守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.
这是我的makefile:
This is my makefile:
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
it不工作,请参见下面的输出。我想这是与.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源文件的正确后缀 - Intel Fortran编译器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!