Fw: Linker erotisi

mikean1 linux greek - security mikean at iesl.forth.gr
Mon Apr 30 13:08:01 EEST 2001



> Kalimera! exo tin exis erotisi gia ton GNU linker
> exo auta ta 2 c programata:
>
>
> /* subfct.c */
> int subfct (void)
> {
> printf ("message from subroutine version 1 \n") ;
> return 0 ;
> } /* end version 1 */
>
> kai
>
> /* "main file" basic.c */
> /* multiple defined subroutines
> test of compiler result
> */
> #include <stddef.h>
> #include <stdio.h>
> int subfct (void) ;
> int main(void)
> {
> printf ("message from main part \n") ;
> subfct () ;
> return 0 ;
> } /* end main */
> int subfct (void)
> {
> printf ("message from subroutine version 2 \n") ;
> return 0 ;
> } /* end version 2 */
>
> kano loipon gcc -c subfct.c
> kai ftiaxno to subfct.o
>
> meta pao na kano link to basic.c kai to subfct.o
> gcc -o a.out basic.c subfct.o
>
> fysika o linker petaei error:
> subfct.o: In function `subfct':
>
> subfct.o(.text+0x0): multiple definition of `subfct'
>
> /tmp/ccyW6bjr.o(.text+0x24): first defined here
>
> collect2: ld returned 1 exit status
>
> Yparxei kapoios tropos na po ston compiler na min xrisimopoihsei tin
> subroutina subfct
> pou brisketa sto basic.c alla tin routina apo to .o file i genika apo
kapoia
> alli library.????
>
>
>
>
> --
> linux-greek-users mailing list -- http://lists.hellug.gr
>




More information about the Linux-greek-users mailing list