[H-GEN] redefined symbol errors with gcc.

Martin Pool martinp at mincom.com
Wed Nov 10 22:44:07 EST 1999


[ Humbug *General* list - semi-serious discussions about Humbug and
Unix-related topics. ]

Andrae Muys wrote:

> Ok, given the following two files and their attempted compilation:
> 
> [andrae at reynier test]$ cat multilink1.c
> int main () { }
> [andrae at reynier test]$ cat multilink2.c
> int main() { }
> [andrae at reynier test]$ gcc -c multilink*.c
> [andrae at reynier test]$ gcc -o multilink multilink*.o
> multilink2.o: In function `main':
> multilink2.o(.text+0x0): multiple definition of `main'
> multilink1.o(.text+0x0): first defined here
> collect2: ld returned 1 exit status
> [andrae at reynier test]$
> 
> Does anyone know what compile options I can pass to gcc to force this to
> succeed?  

Well, that seems to work OK if one of them is a library, so.. make one a
library, perhaps, or do `gcc -v' to see how the linker is called when
one is a library?  Dunno.

-- 
 /\\\  Mincom | Martin Pool          | martinp at mincom.com
// \\\        | Software Engineer    | Phone: +61 7 3303-3333
\\ ///        | Mincom Ltd.          | 
 \///         | Teneriffe, Brisbane  | Speaking for myself only

--
This is list (humbug) general handled by majordomo at lists.humbug.org.au .
Postings only from subscribed addresses of lists general or general-post.



More information about the General mailing list