Compiler un fichier de base en C sur fedora

Fermé
jojo - 30 avril 2008 à 15:29
lami20j Messages postés 21331 Date d'inscription jeudi 4 novembre 2004 Statut Modérateur, Contributeur sécurité Dernière intervention 30 octobre 2019 - 30 avril 2008 à 20:05
Bonjour,


je n'arrive plus à compiler un petit fichier test.c constitué d'un seul printf.
j'ai pourtant installer le gcc sur ma fedora et voilà ce que ça me retourne:

[membre_sacer@localhost noeud]$ gcc test -o test.c
test: In function `_start':
(.text+0x0): multiple definition of `_start'
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../crt1.o:(.text+0x0): first defined here
test:(.rodata+0x0): multiple definition of `_fp_hw'
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../crt1.o:(.rodata+0x0): first defined here
test: In function `_fini':
(.fini+0x0): multiple definition of `_fini'
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../crti.o:(.fini+0x0): first defined here
test:(.rodata+0x4): multiple definition of `_IO_stdin_used'
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../crt1.o:(.rodata.cst4+0x0): first defined here
test: In function `__data_start':
(.data+0x0): multiple definition of `__data_start'
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../crt1.o:(.data+0x0): first defined here
test:(.rodata+0x8): multiple definition of `__dso_handle'
/usr/lib/gcc/i386-redhat-linux/4.3.0/crtbegin.o:(.rodata+0x0): first defined here
test: In function `_init':
(.init+0x0): multiple definition of `_init'
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../crti.o:(.init+0x0): first defined here
/usr/lib/gcc/i386-redhat-linux/4.3.0/crtend.o:(.dtors+0x0): multiple definition of `__DTOR_END__'
test:(.dtors+0x4): first defined here
/usr/bin/ld: warning: Cannot create .eh_frame_hdr section, --eh-frame-hdr ignored.
/usr/bin/ld: error in test(.eh_frame); no .eh_frame_hdr table will be created.
collect2: ld returned 1 exit status

on ne sait jamais peut-être que qq à la solution.
A voir également:

4 réponses

tatou_38 Messages postés 1928 Date d'inscription vendredi 21 avril 2006 Statut Membre Dernière intervention 5 août 2015 120
30 avril 2008 à 16:33
Montre ton programme, je crais le pire !
0
il n' y a rien de compliquer.
d'autant plus que hier ça marché très bien!!!!


#include <stdio.h>
#include <stdlib.h>

int main(){

printf("test \n");
return 0;

}
0
lami20j Messages postés 21331 Date d'inscription jeudi 4 novembre 2004 Statut Modérateur, Contributeur sécurité Dernière intervention 30 octobre 2019 3 567
30 avril 2008 à 17:11
Salut,

au début de ton fichier as-tu mis #include <stdio.h> ?
si oui, alors je pense que le fichier n'existe pas
en ce cas tu dois installer la libraire libc developpement (sous debian c'est libc6-dev)
0
en fait pour dire vrai, il m'efface le fichier à chaque fois que je compile gcc test -o test.c .
je dois remettre une copie dans mon dossier.

je pense que la libc se trouve dans ce paquet:

[root@localhost noeud]# yum install glibc
Loaded plugins: refresh-packagekit
Setting up Install Process
Parsing package install arguments
Package glibc-2.8-1.i686 already installed and latest version
Nothing to do
[root@localhost noeud]#
0
tatou_38 Messages postés 1928 Date d'inscription vendredi 21 avril 2006 Statut Membre Dernière intervention 5 août 2015 120
30 avril 2008 à 18:48
gcc test -o test.c

-o test.c don ton compilo écrit le fichier objet dans ... test.c

gcc test.c suffit !
0
lami20j Messages postés 21331 Date d'inscription jeudi 4 novembre 2004 Statut Modérateur, Contributeur sécurité Dernière intervention 30 octobre 2019 3 567
30 avril 2008 à 20:05
Salut,

gcc test.c suffit !

Pour compléter tatou_38 ;-)
en ce cas le fichier exécutable s'appelle a.out
0