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: "Dr H. T. Leung" <htl10 at cus dot cam dot ac dot uk>
- Subject: Re: *.f *.c linking problem - g77 = gcc (options)?
- From: Thomas Kunert <kunert at physik dot tu-dresden dot de>
- Date: Tue, 14 Jul 1998 15:09:29 +0200
- CC: egcs-bugs at cygnus dot com
- Organization: TU Dresden
- References: <Pine.SOL.3.96.980714104236.13228A-100000@ursa.cus.cam.ac.uk>
Dr H. T. Leung wrote:
>
> This is the error messages I got, with the egcs g77 or "gcc -lf2c_broken"
> (a stripped out version of f2c without main.o):
>
> ------------------------------------------------------------------
> gcc -lf2c_broken -Wall -o bin/sim -l -nag
> /usr/lib/crt1.o: In function `_start':
> /usr/lib/crt1.o(.text+0x5a): undefined reference to `main'
> collect2: ld returned 1 exit status
> make: *** [bin/sim] Error 1
>
> g77 -Wall -o bin/sim -lm -lnag
> /usr/local/lib/gcc-lib/i686-pc-linux-gnulibc1/egcs-2.90.29/libf2c.a(main.o):
> In function `main':
> /home/Hin-Tak/egcs-1.0.3a/gcc/f/runtime/libF77/main.c:128: undefined
> reference to `MAIN__'
> collect2: ld returned 1 exit status
> make: *** [bin/sim] Error 1
> --------------------------------------------------------------
Just add the following function:
extern "C" int MAIN__(){ assert(0); return 0; }
It is never called.
This has done the job for me.
--
Thomas Kunert