This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: *.f *.c linking problem - g77 = gcc (options)?
- To: htl10 at cus dot cam dot ac dot uk
- Subject: Re: *.f *.c linking problem - g77 = gcc (options)?
- From: Craig Burley <burley at gnu dot org>
- Date: Wed, 15 Jul 1998 09:53:23 -0400 (EDT)
- CC: kunert at physik dot tu-dresden dot de, egcs-bugs at cygnus dot com
>> gcc -lf2c_broken -Wall -o bin/sim -l -nag
Why are you using that ordering? And what does `-l' by itself do, or
`-nag'? I don't recognize that stuff.
The normal way to link libf2c is:
gcc foo.f bar.c ... -lf2c -lm
That is, -lf2c (or -lf2c_broken) should precede -lm every time, but
both should follow all Fortran (or C output by f2c) modules.
>> g77 -Wall -o bin/sim -lm -lnag
-v hopefully would show that `-lg2c' gets inserted automatically by
g77 before `-lm'. Which might be not what you want....
>> /home/Hin-Tak/egcs-1.0.3a/gcc/f/runtime/libF77/main.c:128: undefined
>> reference to `MAIN__'
That's because you didn't link any non-library code, in particular,
no Fortran main program unit compiled by g77 or f2c, and, besides,
no main() program unit (unless you indeed specify -lg2c, which
has one of those).
tq vm, (burley)