This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: *.f *.c linking problem - g77 = gcc (options)?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]