Topic: Iargc() and Getarg()

)/Trying to compile some relatively old (90/95) code, and get the following compile time errors:

Generating target.exe
..\Test symbol table\F77_CLEANUP source code.o:F77_CLEANUP source code.f:(.text+0x15c0): undefined reference to `iargc_'
..\Test symbol table\F77_CLEANUP source code.o:F77_CLEANUP source code.f:(.text+0x1883): undefined reference to `getarg_'
..\Test symbol table\F77_CLEANUP source code.o:F77_CLEANUP source code.f:(.text+0x1b40): undefined reference to `getarg_'
collect2.exe: error: ld returned 1 exit status
Error: Last command making (target.exe) returned a bad status
Error: Make execution terminated

Apparently iargc() and getarg() are intrinsic functions for GNU 77, which this compiler is based upon?  Is this correct, and if so, are there any compiler or linker settings that need to be in place to compile properly?

Thanks!

Re: Iargc() and Getarg()

Our included compiler, GNU Fortran, is not actually based on the old GNU g77 compiler; it is an entirely different compiler.  However, the runtime library should provide those routines for backwards compatibility purposes.  Do you happen to have a Fortran standard flag set?

Regardless, you could (and probably should) change them to the current standards-compliant calls:

iargc becomes command_argument_count

getarg becomes get_command_argument

Again, unless you've set a flag/option to enforce a standard, the original code should have worked.  I'll look into it.

Jeff Armstrong
Approximatrix, LLC

3 (edited by Lewist57 2024-02-25 14:16:47)

Re: Iargc() and Getarg()

Yup I had Fortran set to 95. Complies just fine when set to Legacy. Thanks!