main.o(.text+0x29e): undefined reference to `getarg_
Daniel Heiserer
Daniel.Heiserer@bmw.de
Tue Feb 15 08:04:00 GMT 2005
>>I downloded a ia32-linux binary from the gfortran page.
>>I found out why my example did not work:
>>c----------------
>> PROGRAM test
>> implicit none
>> external getarg
>> character*80 argv(50)
>> integer*4 argc
>> do argc=1,iargc()
>> call getarg(argc,argv(argc))
>> write(6,'(" Argument ",I2," is ",A)') argc, argv(argc)
>> enddo
>> END
>>c----------------
>>
>>The key point is the "external getarg" command. If I remove it it works.
>>I do not know if this defintion is an error on my side or if it is a bug
>>of the compiler, but other f90/f77 compilers required it, and g77 as
>>well as g95 got along with it.
>>
>
>
> "external getarg" tells the compiler that you are linking a
> user-defined external procedure. "getarg" in gfortran is an
> intrinsic procedure if you use the -std=gnu option, which is
> the default. If you use -std=f95, then "getarg" is not an
> intrinsic procedure, and gfortran would issue an error during
> the link stage because getarg_() would be missing if you do
> not supply one.
I appreciate the fact that it is part of the delivery, but
as is there is no compatibility with other fortran compiler and g77.
-- daniel
More information about the Fortran
mailing list