无法使用 include 语句编译 Fortran 代码

Impossible to compile Fortran code with include statement

我有一个脚本 "simul.f" 以一行

开头
include 'support.f'

我还有 "support.f" 脚本。上面显示的行是唯一调用 support.f 的行,所以我尝试使用以下方法编译它们:

gfortran -o executable support.f simul.f

我收到以下错误:

/home/pmachado3/LarryProject Oficial/WI1_francisco/T2/WI4/FF04/04-1$ gfortran -o exec support.f simul.f /tmp/ccOicDhk.o: In function support_': simul.f:(.text+0x0): multiple definition ofsupport_' /tmp/ccnkwMCD.o:support.f:(.text+0x0): first defined here collect2: ld returned 1 exit status

我进行了测试并尝试从 simul.f 中删除 include 行,但它编译了但没有生成应该生成

的输出文件 .txt

有什么方法可以在 Unix 中使用 include 行编译代码吗??

代码在 Windows 上运行良好并且是用 Force 2.0

编写的

您只需编译包含 include 语句的文件

 gfortran -o executable simul.f 

并且 include 由编译器自动执行。

如果包含的文件在其他目录中path你必须告诉编译器那个路径在哪里

 gfortran -o executable simul.f -Ipath