This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: multiple definition of `MAIN__'
- From: Fabian Braennstroem <f dot braennstroem at gmx dot de>
- To: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Mon, 29 Dec 2003 23:16:24 +0100
- Subject: Re: multiple definition of `MAIN__'
- Organization: Fabian Braennstroem
- References: <1072637920.9401.30.camel@rechner1.ddorf.de> <3FF0273E.2040407@moene.indiv.nluug.nl>
- Reply-to: f dot braennstroem at gmx dot de
On Mon, 2003-12-29 at 14:08, Toon Moene wrote:
> Fabian Braennstroem wrote:
> > Hello,
> >
> > I am still trying to adjust an sgi-fortran-code to linux g77. I get
> > this error-message:
> >
> > main.o(.text+0x10c3): In function `MAIN__':
> > : undefined reference to `save_vel__'
> > main.o(.text+0x10d2): In function `MAIN__':
> > : undefined reference to `save_pres__'
> > collect2: ld returned 1 exit status
> > make: *** [calc_les_03_cube] Error 1
> >
THAT is the correct error-message:
save_vel.o(.text+0xcd1): In function `MAIN__':
: multiple definition of `MAIN__'
main.o(.text+0x0): first defined here
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/../../../../i686-pc-linux-gnu/bin/ld: Warning: size of symbol `MAIN__' changed from 5155 in main.o to 5 in save_vel.o
save_pres.o(.text+0x763): In function `MAIN__':
: multiple definition of `MAIN__'
main.o(.text+0x0): first defined here
collect2: ld returned 1 exit status
make: *** [calc_les_03_cube] Error 1
> Did you compile save_vel.f and save_pres.f with g77 as well ?
>
> Note that g77 appends two underscores to the name of a subroutine that
> contains an underscore.
>
> If you just assume the loader will get save_vel and save_pres from a
> library compiled with another compiler that doesn't append the extra
> underscore, you're out of luck.
>
> Anyways, don't assume g77-compiled code and code compiled with another
> compiler on your SGI machine will work together flawlessly, even if the
> loader phase succeeds ...
>
Thanks for the tips, but all subroutines were compiled with g77 under
linux.
When I copy the subroutine save_vel into 'main.f', the compilation works
fine. Why? Is it a 'makefile'-mistake?
Greetings!
Fabian