Probleme avec un makefile, help!
Résolu
bonjour,
je viens juste de terminer a coder un jeu en langage C sous SDL. comme j'ai plusieurs fichier ".C "et" .h" j'ai créée un Makefile afin de faire une compilation séparée mais aussi pour l'édition des liens. le problème est que lorsque j'essaye d'appeler le make file j'ai des erreurs. j'ai vraiment du mal a voir d'elle viennent.
voici ce que j'obtiens:
#########################################################
zemzm@ubuntu:~/Bureau/Projet_2010_V_27_04/IN211$ make principal
make: « principal » est à jour.
zemzm@ubuntu:~/Bureau/Projet_2010_V_27_04/IN211$ make principal
gcc -O2 -Wall 'sdl-config --cflags' -o principal.o -c principal.c
gcc -O2 -Wall 'sdl-config --cflags' -o principal principal.o Matrice.o jeux_plateau.o graphics.o 'sdl-config --libs' -lm -lSDL_ttf
/usr/bin/ld: i386 architecture of input file 'Matrice.o' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file 'jeux_plateau.o' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file 'graphics.o' is incompatible with i386:x86-64 output
graphics.o: In function 'wait_clic':
graphics.c:(.text+0x210): undefined reference to '__stdoutp'
graphics.o: In function 'write_text':
graphics.c:(.text+0x519): undefined reference to '__stderrp'
graphics.c:(.text+0x54b): undefined reference to '__stdoutp'
graphics.o: In function 'affiche_all':
graphics.c:(.text+0x66b): undefined reference to '__stderrp'
graphics.c:(.text+0x682): undefined reference to '__stderrp'
graphics.o: In function 'wait_clic_GMD':
graphics.c:(.text+0x1a76): undefined reference to '__stdoutp'
graphics.o: In function 'init_graphics':
graphics.c:(.text+0x1de0): undefined reference to '__stderrp'
graphics.o: In function 'lire_entier_clavier':
graphics.c:(.text+0x1e67): undefined reference to '__stdoutp'
collect2: ld returned 1 exit status
make: *** [principal] Erreur 1
zemzm@ubuntu:~/Bureau/Projet_2010_V_27_04/IN211$ ./principal
bash: ./principal: Aucun fichier ou dossier de ce type
zemzm@ubuntu:~/Bureau/Projet_2010_V_27_04/IN211$
#########################################################
Merci pour votre aide. je vous mets aussi le Make fille.
##################################################################################################################
CFLAGS=-O2 -Wall 'sdl-config --cflags'
LIBS='sdl-config --libs' -lm -lSDL_ttf
DIR=IN210_5
#Cible generique pour Linux
%: graphics.o %.c
rm -f $@
$(CC) $(CFLAGS) graphics.o $@.c -o $@ $(LIBS)
#Cible generique pour free BSD
.c .o: graphics.o
rm -f $@
$(CC) $(CFLAGS) graphics.o $@.c -o $@ $(LIBS)
graphics.o: graphics.c graphics.h
rm -f police.h
touch police.h
if test -e /usr/include/SDL_ttf.h; then echo "#define SDL_TTF_OK" > police.h; fi
if test -e /usr/include/SDL/SDL_ttf.h; then echo "#define SDL_TTF_OK" > police.h; fi
if test -e /usr/local/include/SDL_ttf.h; then echo "#define SDL_TTF_OK" > police.h; fi
if test -e /usr/local/include/SDL/SDL_ttf.h; then echo "#define SDL_TTF_OK" > police.h; fi
$(CC) $(CFLAGS) -c graphics.c
sans_ttf:
rm -f police.h
touch police.h
$(CC) $(CFLAGS) -c graphics.c
$(CC) $(CFLAGS) graphics.o principal.c -o principal $(LIBS)
./principal
principal: principal.o Matrice.o jeux_plateau.o graphics.o
$(CC) $(CFLAGS) -o principal principal.o Matrice.o jeux_plateau.o graphics.o $(LIBS)
principal.o: principal.c jeux_plateau.h
$(CC) $(CFLAGS) -o principal.o -c principal.c
Matrice.o: Matrice.c Matrice.h graphics.h
$(CC) $(CFLAGS) -o Matrice.o -c Matrice.c
jeux_plateau.o: jeux_plateau.c jeux_plateau.h
$(CC) $(CFLAGS) -o jeux_plateau.o -c jeux_plateau.c
tar: clean
rm -rf $(DIR)
mkdir $(DIR)
cp principal.c $(DIR)
cp graphics.c $(DIR)
cp graphics.h $(DIR)
cp couleur.h $(DIR)
cp Makefile $(DIR)
cp *.ttf $(DIR)
tar cvf $(DIR).tar $(DIR)
rm -rf $(DIR)
clean:
rm -f *core
rm -f *.o
rm -f police.h
rm -f principal
rm -f *.tar
rm -rf $(DIR)
#########################################################
je viens juste de terminer a coder un jeu en langage C sous SDL. comme j'ai plusieurs fichier ".C "et" .h" j'ai créée un Makefile afin de faire une compilation séparée mais aussi pour l'édition des liens. le problème est que lorsque j'essaye d'appeler le make file j'ai des erreurs. j'ai vraiment du mal a voir d'elle viennent.
voici ce que j'obtiens:
#########################################################
zemzm@ubuntu:~/Bureau/Projet_2010_V_27_04/IN211$ make principal
make: « principal » est à jour.
zemzm@ubuntu:~/Bureau/Projet_2010_V_27_04/IN211$ make principal
gcc -O2 -Wall 'sdl-config --cflags' -o principal.o -c principal.c
gcc -O2 -Wall 'sdl-config --cflags' -o principal principal.o Matrice.o jeux_plateau.o graphics.o 'sdl-config --libs' -lm -lSDL_ttf
/usr/bin/ld: i386 architecture of input file 'Matrice.o' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file 'jeux_plateau.o' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file 'graphics.o' is incompatible with i386:x86-64 output
graphics.o: In function 'wait_clic':
graphics.c:(.text+0x210): undefined reference to '__stdoutp'
graphics.o: In function 'write_text':
graphics.c:(.text+0x519): undefined reference to '__stderrp'
graphics.c:(.text+0x54b): undefined reference to '__stdoutp'
graphics.o: In function 'affiche_all':
graphics.c:(.text+0x66b): undefined reference to '__stderrp'
graphics.c:(.text+0x682): undefined reference to '__stderrp'
graphics.o: In function 'wait_clic_GMD':
graphics.c:(.text+0x1a76): undefined reference to '__stdoutp'
graphics.o: In function 'init_graphics':
graphics.c:(.text+0x1de0): undefined reference to '__stderrp'
graphics.o: In function 'lire_entier_clavier':
graphics.c:(.text+0x1e67): undefined reference to '__stdoutp'
collect2: ld returned 1 exit status
make: *** [principal] Erreur 1
zemzm@ubuntu:~/Bureau/Projet_2010_V_27_04/IN211$ ./principal
bash: ./principal: Aucun fichier ou dossier de ce type
zemzm@ubuntu:~/Bureau/Projet_2010_V_27_04/IN211$
#########################################################
Merci pour votre aide. je vous mets aussi le Make fille.
##################################################################################################################
CFLAGS=-O2 -Wall 'sdl-config --cflags'
LIBS='sdl-config --libs' -lm -lSDL_ttf
DIR=IN210_5
#Cible generique pour Linux
%: graphics.o %.c
rm -f $@
$(CC) $(CFLAGS) graphics.o $@.c -o $@ $(LIBS)
#Cible generique pour free BSD
.c .o: graphics.o
rm -f $@
$(CC) $(CFLAGS) graphics.o $@.c -o $@ $(LIBS)
graphics.o: graphics.c graphics.h
rm -f police.h
touch police.h
if test -e /usr/include/SDL_ttf.h; then echo "#define SDL_TTF_OK" > police.h; fi
if test -e /usr/include/SDL/SDL_ttf.h; then echo "#define SDL_TTF_OK" > police.h; fi
if test -e /usr/local/include/SDL_ttf.h; then echo "#define SDL_TTF_OK" > police.h; fi
if test -e /usr/local/include/SDL/SDL_ttf.h; then echo "#define SDL_TTF_OK" > police.h; fi
$(CC) $(CFLAGS) -c graphics.c
sans_ttf:
rm -f police.h
touch police.h
$(CC) $(CFLAGS) -c graphics.c
$(CC) $(CFLAGS) graphics.o principal.c -o principal $(LIBS)
./principal
principal: principal.o Matrice.o jeux_plateau.o graphics.o
$(CC) $(CFLAGS) -o principal principal.o Matrice.o jeux_plateau.o graphics.o $(LIBS)
principal.o: principal.c jeux_plateau.h
$(CC) $(CFLAGS) -o principal.o -c principal.c
Matrice.o: Matrice.c Matrice.h graphics.h
$(CC) $(CFLAGS) -o Matrice.o -c Matrice.c
jeux_plateau.o: jeux_plateau.c jeux_plateau.h
$(CC) $(CFLAGS) -o jeux_plateau.o -c jeux_plateau.c
tar: clean
rm -rf $(DIR)
mkdir $(DIR)
cp principal.c $(DIR)
cp graphics.c $(DIR)
cp graphics.h $(DIR)
cp couleur.h $(DIR)
cp Makefile $(DIR)
cp *.ttf $(DIR)
tar cvf $(DIR).tar $(DIR)
rm -rf $(DIR)
clean:
rm -f *core
rm -f *.o
rm -f police.h
rm -f principal
rm -f *.tar
rm -rf $(DIR)
#########################################################
A voir également:
- Make: *** pas de cible spécifiée et aucun makefile n'a été trouvé. arrêt.
- Cette photo n’a pas été prise cette année. trouvez la date, l'heure et avec quel modèle d'appareil photo elle a été prise. - Forum Samsung
- Mon compte facebook a été désactivé - Guide
- Aucun pilote de périphérique n'a été détecté windows 10 - Forum Windows 10
- Cherche le nom d'un modèle d'appareil photo ✓ - Forum Photo numérique
- Mon compte instagram a été désactivé - Guide
3 réponses
Je n'ai pas trop compris comment tu t'es débrouillé, mais manifestement il y a un mix bizarre entre l'architecture utilisée dans tes binaires par rapport à tes librairies (du genre .o 32 bits et librairies 64 bits).
Si on en croit ce lien il suffirait de compiler avec l'option -m32 :
https://www.linux-noob.com/forums/topic/3420-32bit-apps-in-fc8-x86_64/
.. voire installer quelques paquets :
http://ubuntuforums.org/showthread.php?t=303183
Essaye aussi de voire dans la doc de gcc :
http://www.linux-kheops.com/doc/man/manfr/man-html-0.9/man1/gcc.1.html
Bonne chance
Si on en croit ce lien il suffirait de compiler avec l'option -m32 :
https://www.linux-noob.com/forums/topic/3420-32bit-apps-in-fc8-x86_64/
.. voire installer quelques paquets :
http://ubuntuforums.org/showthread.php?t=303183
Essaye aussi de voire dans la doc de gcc :
http://www.linux-kheops.com/doc/man/manfr/man-html-0.9/man1/gcc.1.html
Bonne chance
bonsoir ou bonjour mamiemando,
tout d'abord merci d'avoir pris de ton temps pour me répondre.
en effet j'ai réussit à compiler et a exécuter mon projet . le Makefile été bon
mais au début de mon projet j'ai généré des fichier ".o" sans passe par le make file et apparemment le make file n'a pas trop aimait. du coup j'ai juste effacer tout les ".o" existant avant que je lance le makefile. et tout marche nikel. mon projet est fini, ouf.
bonne soirée à toi.
Zemzm
tout d'abord merci d'avoir pris de ton temps pour me répondre.
en effet j'ai réussit à compiler et a exécuter mon projet . le Makefile été bon
mais au début de mon projet j'ai généré des fichier ".o" sans passe par le make file et apparemment le make file n'a pas trop aimait. du coup j'ai juste effacer tout les ".o" existant avant que je lance le makefile. et tout marche nikel. mon projet est fini, ouf.
bonne soirée à toi.
Zemzm