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:
> 
> 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


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