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)
#########################################################
