main.o(.text+0x29e): undefined reference to `getarg_

Daniel Heiserer Daniel.Heiserer@bmw.de
Fri Feb 11 13:13:00 GMT 2005


Francois-Xavier.Coudert@lcp.u-psud.fr wrote:
>> the getarg function seems not to be implemented in gfortran.
> 
> 
> Would you please specify what platform you use, where you obtained your 
> gfortran binaries (did you build it from scratch or downloaded it 
> somewhere) and what is the smallest program that fails.

Hi,

sorry for the delay.
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.

best regards and thanks for your efforts,

daniel heiserer







> For me, on i686-linux (self-made binaries), it works (TM):
> 
> program test
>   character(len=50) :: s
>   call getarg (0, s)
>   print *, s
> end program test
> 
> I get the correct output:
> $ gfortran a.f90 && ./a.out
>  ./a.out
> 
> Thanks,
> FX
> 
> 



More information about the Fortran mailing list