LA COMPILATION SEPAREE
Fermé
jeandchanel
Messages postés
135
Date d'inscription
Statut
Membre
Dernière intervention
-
baladur13 Messages postés 47821 Date d'inscription Statut Modérateur Dernière intervention -
baladur13 Messages postés 47821 Date d'inscription Statut Modérateur Dernière intervention -
Bonjour,
J'ai un soucis avec mon IDE (Cloud9, IDE en ligne !) . Je ne sais pas si c'est moi ou c'est l'IDE qui déconne? Enfin bon, voici le problème, je voudrais faire la compilation séparée et j'ai donc créer 02 fichiers pour mon jeu a savoir jeu.c (qui contient toutes les fonctions a utiliser dans mon jeu) et jeu.h (qui contient tous les prototypes des fonctions créer dans jeu.c) ensuite j'ai inclus le fichier jeu.h dans les fichiers jeu.c et main.c (qui s'appelle mastermind.c) voici d'ailleurs les 03 fichiers :
...Mais a ma grande surprise voici la reponse de mon IDE (Cloud9) :
Running "/home/ubuntu/workspace/Le_Mastermind2/mastermind.c"
/tmp/ccCkUGpF.o: In function `main':
mastermind.c:(.text+0x90): undefined reference to `debutPartie'
mastermind.c:(.text+0x9f): undefined reference to `demanderModeJeu'
mastermind.c:(.text+0xe7): undefined reference to `demanderNiveauJeu'
mastermind.c:(.text+0x259): undefined reference to `nombreAleatoire'
mastermind.c:(.text+0x2ad): undefined reference to `lire'
mastermind.c:(.text+0x4bd): undefined reference to `lireLong'
mastermind.c:(.text+0x4fd): undefined reference to `lireLong'
mastermind.c:(.text+0x53b): undefined reference to `combiAleatoire'
mastermind.c:(.text+0x596): undefined reference to `lire'
mastermind.c:(.text+0x831): undefined reference to `rejouerPartie'
collect2: error: ld returned 1 exit status
Process exited with code: 1
Espérant avoir posé clairement le problème, j’attends impatiemment vos réponses, merci d'avance a vous les experts du langage C.
J'ai un soucis avec mon IDE (Cloud9, IDE en ligne !) . Je ne sais pas si c'est moi ou c'est l'IDE qui déconne? Enfin bon, voici le problème, je voudrais faire la compilation séparée et j'ai donc créer 02 fichiers pour mon jeu a savoir jeu.c (qui contient toutes les fonctions a utiliser dans mon jeu) et jeu.h (qui contient tous les prototypes des fonctions créer dans jeu.c) ensuite j'ai inclus le fichier jeu.h dans les fichiers jeu.c et main.c (qui s'appelle mastermind.c) voici d'ailleurs les 03 fichiers :
//fichier jeu.h en entier pour le jeu " Mastermind Numerique " #ifndef DEF_JEU #define DEF_JEU #define SOLO 1 #define MULTI 2 typedef struct Niveau Niveau; struct Niveau { char nomNiveau[100]; int coupsMax; int nbChiffre; }; Niveau niveaux[] = { {"Facile", 15, 4}, {"Moyen", 12, 5}, {"Difficile", 10, 6} }; extern void viderBuffer(); extern int lire(char* chaine, int longueurChaine); extern long lireLong(); extern void debutPartie(); extern long demanderModeJeu(long modeJeu); extern Niveau demanderNiveauJeu(long choixNiveau); extern void nombreAleatoire(char *combinaison, Niveau niveauJeu); extern void combiAleatoire(char *combinaison, int nbChiffre); extern bool rejouerPartie(); #endif //Un extrait du fichier jeu.c pour le jeu " Mastermind Numerique " #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <stdbool.h> #include "jeu.h" void viderBuffer() { int c = 0; while(c != '\n' && c != EOF) { c = getchar(); } } //Un extrait du fichier mastermind.c #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <stdbool.h> #include "jeu.h" #define TAILLE_MAX 25 void viderBuffer();
...Mais a ma grande surprise voici la reponse de mon IDE (Cloud9) :
Running "/home/ubuntu/workspace/Le_Mastermind2/mastermind.c"
/tmp/ccCkUGpF.o: In function `main':
mastermind.c:(.text+0x90): undefined reference to `debutPartie'
mastermind.c:(.text+0x9f): undefined reference to `demanderModeJeu'
mastermind.c:(.text+0xe7): undefined reference to `demanderNiveauJeu'
mastermind.c:(.text+0x259): undefined reference to `nombreAleatoire'
mastermind.c:(.text+0x2ad): undefined reference to `lire'
mastermind.c:(.text+0x4bd): undefined reference to `lireLong'
mastermind.c:(.text+0x4fd): undefined reference to `lireLong'
mastermind.c:(.text+0x53b): undefined reference to `combiAleatoire'
mastermind.c:(.text+0x596): undefined reference to `lire'
mastermind.c:(.text+0x831): undefined reference to `rejouerPartie'
collect2: error: ld returned 1 exit status
Process exited with code: 1
Espérant avoir posé clairement le problème, j’attends impatiemment vos réponses, merci d'avance a vous les experts du langage C.
A voir également:
- LA COMPILATION SEPAREE
- Breach compilation c'est quoi - Guide
- Compilation error: expected unqualified-id before '{' token ✓ - Forum C++
- Erreur de compilation projet ou bibliothèque introuvable - Forum Excel
- Must declare a named package because this compilation unit is associated to the named module - Forum Java
- Erreur de compilation : Projet ou bibliothèque introuvable - Forum VB / VBA
2 réponses
Bonjour,
Prière de continuer sur la première conversation..
https://forums.commentcamarche.net/forum/affich-33954633-le-mastermind-numerique#newanswer
Merci
Prière de continuer sur la première conversation..
https://forums.commentcamarche.net/forum/affich-33954633-le-mastermind-numerique#newanswer
Merci