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 10:56:42 +0200
- CC: egcs-bugs at cygnus dot com
- Organization: TU Dresden
- References: <Pine.SOL.3.96.980713191448.11621A-100000@ursa.cus.cam.ac.uk>
Dr H. T. Leung wrote:
>
> For a very strange reason, somebody whose code on SunSparc I am tryng to
> port to linux decided to have fortran routines, but a c main program
> wrapper and some c routines.
>
> So on Sunsparc he was doing something like:
>
> f77 src/routine1.f -c -o obj/routine1.o
> cc src/routine2.c -c -o obj/routine2.o
> cc src/wrapper.c -c -o obj/wrapper.o
> -----where wrapper.c contains a main() routine
> f77 -o result-binary obj/*.o -llib1 -llib2
>
> This does not work for egcs g77 since libf2c contains main.o also.
[...]
Strange. I have done such things for some time now and never had any
problems. I have no idea how the doubly occuring main()'s are handled,
but it works without problems. I use c++, not c, but this shouldn't be a
big difference.
g++ -Wall fortran.o cplusplus.o -lf2c
doesn't even emit a warning.
--
Thomas Kunert