GFortran 不知道 system()

GFortran doesn't know system()

我正在尝试在 Fortran 中执行命令,因为我们的集群使用旧的编译器,所以我无法使用 execute_command_line。因此,我正在尝试切换到系统:

    succ = system("zip -0q " // zipfile &
                             // " " // npy_name)
    if(succ /=  0) then
        write (*,*) "Can't execute zip command"
    endif

对于 IFort 我可以使用:

    USE IFPORT

而且效果很好。 GFortran 不知道这个库(因为它是英特尔)所以我把它注释掉然后我得到:

~/NPY-for-Fortran/src/npy.f90:52:15:

         succ = system("rm " // npy_name)
               1
Error: Function ‘system’ at (1) has no IMPLICIT type

如何在命令行中执行命令,使其适用于新旧编译器以及 Intel 和 GNU?如果您需要一个完整的工作环境,这是整个源文件:

https://github.com/MRedies/NPY-for-Fortran.git

system 是 GFortran 中 GNU 扩展标准的一部分,因此您必须使用该标准(例如,而不是 std=f95)。

gfortran -std=gnu file.f90