Stein
Stein

Reputation: 3277

GFortran doesn't know system()

I'm trying to execute a command in Fortran and because our cluster uses old Compilers I can't use execute_command_line. Therefore I'm trying to switch to system:

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

For IFort I can use:

    USE IFPORT

and it works fine. GFortran doesn't know this library (because it's intels) so I comment it out and then I get:

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

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

How can I execute commands in the command line, such that it works on old & new compilers, as well as Intel & GNU? If you need a full working environment, this is the whole sourcefile:

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

Upvotes: 0

Views: 222

Answers (1)

L. Scott Johnson
L. Scott Johnson

Reputation: 4402

system is a part of the GNU extension standard in GFortran, so you have to be using that standard (and not std=f95, for instance).

gfortran -std=gnu file.f90

Upvotes: 1

Related Questions