Re: multiple definition of `MAIN__'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux